/* ====================================================================
   Radio Club Ochentero | Adaptación para móvil y tablet
   Complemento de styles.css: se mantiene el diseño de escritorio.
   Reglas específicas al final, para evitar conflictos con el CSS legado.
   ==================================================================== */

/* Ajustes no invasivos comunes a todas las resoluciones. */
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
img, video, canvas, svg { max-width: 100%; }
img { height: auto; }
input, select, textarea, button { font: inherit; }
.content, .content > *, .card, .card > *, .layout > *, .tool-box,
.amigo-left, .amigo-left > div, .dl2, .dl2-left, .dl2-meta,
.colaborador-bloque, .privacidad-texto { min-width: 0; }
.card a, .card p, .card h2, .card h3, .card .muted,
.bienvenida p, .footer-rco, .footer-rco a { overflow-wrap: break-word; }
.mobile-nav-toggle { display: none; }

/* Páginas informativas sin barra lateral. */
body > .card:not(.admin-shell) {
  max-width: 960px !important;
  width: calc(100% - 40px) !important;
  margin: 20px auto 32px !important;
}

/* La tabla del panel de socios debe permitir desplazamiento horizontal:
   se conservan todas sus columnas y no se recortan los datos. */
.admin-shell { max-width: 100% !important; margin: 16px !important; }
.admin-table-scroll {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}
.admin-table-scroll table { width: max-content; min-width: 100%; }
.admin-table-scroll th, .admin-table-scroll td { white-space: nowrap; }
.admin-table-scroll:focus-visible { outline: 2px solid #00d6ff !important; outline-offset: 3px; }

@media (max-width: 1100px) {
  :root { --gap: 12px; }

  /* Una columna real: anula los grid-template-columns !important posteriores
     al primer bloque responsive del styles.css original. */
  .layout {
    width: 100% !important;
    max-width: 100% !important;
    margin: 10px auto 26px !important;
    padding: 0 16px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start;
    gap: 12px !important;
  }
  .content { width: 100% !important; max-width: 100% !important; min-width: 0; }
  .sidebar {
    width: 100%;
    position: sticky !important;
    top: calc(var(--topbar-h, 36px) + 6px) !important;
    align-self: start;
    z-index: 45;
  }
  /* Menú desplegable táctil: evita nueve opciones antes de la portada. */
  .mobile-nav-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 11px 16px;
    border: 1px solid rgba(0,229,255,.42);
    border-radius: 14px;
    background: linear-gradient(105deg,#092441,#102e50 65%,#2b2354);
    color: #f3faff;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .02em;
    cursor: pointer;
    text-align: left;
  }
  .mobile-nav-toggle:focus-visible {
    outline: 3px solid #57efff !important;
    outline-offset: 2px !important;
  }
  .mobile-nav-toggle-icon { font-size: 19px; line-height: 1; }
  .mobile-nav-toggle-label { flex: 1; }
  .mobile-nav-toggle-arrow { transition: transform .2s; }
  .sidebar.is-open .mobile-nav-toggle-arrow { transform: rotate(180deg); }
  .sidebar .sidebox { display: none; }
  .sidebar.is-open .sidebox {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 48;
    max-height: calc(100dvh - 115px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #0e1c39;
    border: 1px solid rgba(0,229,255,.38);
    border-radius: 16px;
    box-shadow: 0 20px 38px rgba(0,0,0,.58) !important;
  }
  .sidebar .sideitem {
    min-height: 44px;
    margin: 3px 2px;
    color: #eaf6ff;
  }
  .sidebar .sidebox-title { color: #99b4cc; }
  .sidebar .sideitem.active { color: #fff; }
  .card, .hero-card { max-width: 100% !important; }

  .tools-grid, .colaboradores-grid, .downloads-grid2,
  .grid-2, .links-grid, .downloads-grid, .colab-grid,
  .guia-grid, .bandas-grid, .act-info {
    max-width: 100%;
    min-width: 0;
  }
  .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 15px; }
  .colaboradores-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .downloads-grid2 { grid-template-columns: minmax(0, 1fr) !important; }
  #zona-usuarios .zona-usuarios-botones { grid-template-columns: minmax(0,1fr) !important; }
  .aviso-privacidad { flex-wrap: wrap; }
  .btn-privacidad { white-space: normal; text-align: center; }
  .footer-rco { max-width: 100%; }
}

@media (max-width: 767px) {
  .layout { padding: 0 12px !important; }
  /* El CSS legado reserva 24px solo a la derecha del contenido.
     En móvil esa reserva desplaza las tarjetas a la izquierda.
     Se igualan ambos márgenes sin alterar el escritorio. */
  .layout > .content {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .topbar-inner { padding: 0 12px; gap: 8px; }
  .topbar-left { min-width: 0; font-size: 12px; }
  .topbar-right { flex-shrink: 0; font-size: 12px; padding: 5px 10px; }
  .card { padding: 15px !important; border-radius: 16px !important; }
  .hero-card { padding: 2px !important; }
  .section-head { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
  .section-head > * { max-width: 100%; }
  .section-title, .card h2, .card h3 { overflow-wrap: anywhere; }
  .breadcrumbs { display: inline-flex; max-width: 100%; white-space: normal; overflow-wrap: anywhere; border-radius: 10px; }
  .bienvenida { min-width: 0; max-width: 100%; }
  .bien-head, .bien-title, .bien-footer { flex-wrap: wrap; }
  .bien-head { gap: 12px; }
  .bien-title { min-width: 0; }
  .bien-badge { max-width: 100%; }
  .bien-body { overflow-wrap: anywhere; }
  #hero-portada img { max-height: none !important; object-fit: contain !important; }
  #radio-eventos > div[style], #actividades-campo > div[style] { padding: 12px 2px !important; }
  .qsl-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  #radio-eventos .qsl-gallery a { display: block; min-width: 0; }
  #radio-eventos .qsl-gallery img { display: block; width: 100%; max-width: 100%; height: auto; }
  .tools-grid, .colaboradores-grid, .downloads-grid2,
  .grid-2, .links-grid, .downloads-grid, .colab-grid,
  .activaciones-grid, .guia-grid, .bandas-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }
  .tool-box { width: 100%; min-width: 0; border-radius: 17px; }
  .tool-title { font-size: 17px !important; padding: 16px 16px 12px; overflow-wrap: anywhere; }
  .tool-title::after { max-width: 70%; }
  .tool-box a { min-width: 0; gap: 10px; padding: 14px 16px !important; overflow-wrap: anywhere; }
  .colaborador-bloque { min-width: 0; }
  .colaborador-bloque img { height: auto; max-width: 100%; }
  .amigo-card, #amigos-radio .amigo-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 13px;
  }
  .amigo-left, #amigos-radio .amigo-left { min-width: 0; width: 100%; align-items: center; gap: 10px; }
  .amigo-left img, #amigos-radio .amigo-left img { flex: 0 0 auto; width: 52px; height: 52px; object-fit: contain; }
  .amigo-left h3, #amigos-radio .amigo-left h3 { font-size: 15px !important; }
  .amigo-left p { font-size: 13px; overflow-wrap: anywhere; }
  .btn-amigo, #amigos-radio .btn-amigo { width: 100%; text-align: center; justify-content: center; min-height: 44px; }
  .dl2, .dl2-left { min-width: 0; }
  .dl2 { flex-wrap: wrap; gap: 10px; }
  .dl2-meta, .dl2-title, .dl2-sub { overflow-wrap: anywhere; }
  .dl2-right { flex-wrap: wrap; margin-left: 0; }
  .aviso-privacidad { flex-direction: column; align-items: stretch; gap: 12px; padding: 15px; }
  .btn-privacidad { width: 100%; min-height: 44px; padding: 12px; }
  #zona-usuarios .zona-usuarios-botones { display: grid; grid-template-columns: minmax(0,1fr) !important; }
  #zona-usuarios .zona-usuarios-botones a { width: 100%; min-width: 0; padding: 14px 12px; font-size: 15px; }
  .contacta-box .btn-contacta { display: flex; max-width: 100%; justify-content: center; text-align: center; }
  .social-links { flex-wrap: wrap; justify-content: center; gap: 8px; }
  .footer-rco { padding: 22px 12px; text-align: center; overflow-wrap: anywhere; }
  .footer-links { line-height: 2; }
  .estadisticas-radio { padding: 15px; margin: 22px auto; border-radius: 18px; }
  .estadisticas-grid, .totales-radio { grid-template-columns: minmax(0, 1fr) !important; gap: 12px; }
  .estadisticas-titulo { font-size: clamp(20px, 6vw, 28px); }
  .estadistica-numero, .total-numero { font-size: clamp(40px, 12vw, 65px); overflow-wrap: anywhere; }
  .estadistica-texto, .total-titulo { font-size: clamp(17px, 5vw, 23px); }
  .total-card { padding: 20px 12px; }
  #actividades-campo .campo-item { flex-direction: column; align-items: stretch; padding: 12px; }
  #actividades-campo .campo-img { width: 100%; max-width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; }
  #actividades-campo .campo-info h3 { font-size: 20px; }
  body > .card:not(.admin-shell) { width: calc(100% - 24px) !important; margin: 12px auto !important; }
  .admin-shell { margin: 10px !important; padding: 13px !important; }
  .login-box { width: 100%; max-width: 380px; margin: 30px auto; padding: 20px 15px; }
  #panelAdmin { padding: 10px 0; }
}

@media (max-width: 420px) {
  .layout { padding: 0 9px !important; }
  .card { padding: 12px !important; }
  .qsl-gallery { grid-template-columns: minmax(0, 1fr) !important; }
  .bien-head { flex-direction: column; align-items: flex-start; }
  .bien-badge { align-self: flex-start; }
  .footer-rco .footer-links { font-size: 13px; }
  .topbar-right { padding: 5px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mobile-nav-toggle-arrow { transition: none; }
}

/* Nueva sección de radio: imágenes y enlaces fluidos en pantallas estrechas. */
@media (max-width: 767px) {
  #cq-cq-la-radio > div[style] { padding: 12px 2px !important; }
  #cq-cq-la-radio img { width: 100%; max-width: 100%; height: auto; }
  #cq-cq-la-radio p, #cq-cq-la-radio a { overflow-wrap: anywhere; }
  #cq-cq-la-radio a[style] { max-width: 100%; }
}
