/* RESPONSIVE-TOTAL (18-nov-2026) — capa común de experiencia móvil.
   Archivo estático (no pasa por Vite): se enlaza desde los layouts con
   partials/responsive-total.blade.php. Solo agrega; no reescribe estilos
   de los módulos. Lo que necesita saber del DOM lo marca responsive-total.js
   con clases rt-*.                                                        */

/* ── 1. Base táctil ─────────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (hover: none) and (pointer: coarse) {
    a, button, [role="button"], label, summary, select { -webkit-tap-highlight-color: rgba(238, 190, 4, .18); touch-action: manipulation; }
    /* Respuesta inmediata al tocar: sin esperar el «hover». */
    button:not(:disabled):active, [role="button"]:active, .btn:active,
    a[class*="btn"]:active, a[class*="boton"]:active { opacity: .78; }
}

/* iPhone hace zoom al enfocar un campo con letra < 16 px: lo evita. */
@media (max-width: 767px) and (pointer: coarse) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
    select, textarea { font-size: 16px !important; }
}

/* Videos e iframes incrustados nunca más anchos que su caja (las imágenes ya
   las cubre el preflight de Tailwind; no se tocan para no alterar logos). */
iframe, video { max-width: 100%; }

/* ── 2. Movimiento reducido ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important; animation-iteration-count: 1 !important;
        transition-duration: .01ms !important; scroll-behavior: auto !important;
    }
}

/* ── 3. Fondo quieto mientras hay una hoja o un modal abierto ──────── */
html.rt-bloqueo, html.rt-bloqueo body { overflow: hidden !important; overscroll-behavior: none; }
/* En iPhone, overflow:hidden no basta: el JS fija el body en su posición. */
html.rt-bloqueo-ios body { position: fixed !important; left: 0; right: 0; width: 100%; }
.rt-hoja-panel, .navppp-sheet, [role="dialog"] [class*="overflow-y-auto"] { overscroll-behavior: contain; }

/* ── 4. Modales → hoja inferior en el celular ───────────────────────── */
@media (max-width: 639px) {
    .rt-hoja-ov {
        align-items: flex-end !important; justify-content: center !important;
        padding: 0 !important;
    }
    .rt-hoja-panel {
        width: 100% !important; max-width: 100% !important;
        margin: 0 !important; left: 0 !important; right: 0 !important;
        border-bottom-left-radius: 0 !important; border-bottom-right-radius: 0 !important;
        border-top-left-radius: 20px !important; border-top-right-radius: 20px !important;
        max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px)) !important;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    /* Panel en posición fija centrada (no flex): se pega abajo. */
    .rt-hoja-panel.rt-hoja-fija {
        top: auto !important; bottom: 0 !important; transform: none !important;
    }
}
.rt-agarre {
    display: block; width: 100%; height: 22px; flex: 0 0 auto; cursor: grab;
    position: relative; touch-action: none; background: transparent; border: 0; padding: 0; border-radius: 20px 20px 0 0;
}
.rt-agarre::before {
    content: ""; position: absolute; left: 50%; top: 8px; width: 42px; height: 5px;
    margin-left: -21px; border-radius: 999px; background: rgba(100, 116, 139, .45);
}
@media (min-width: 640px) { .rt-agarre { display: none; } }
.rt-arrastrando { transition: none !important; animation: none !important; }
.rt-soltando { transition: transform .22s cubic-bezier(.2, .8, .2, 1) !important; }

/* X de cierre que agrega el JS a las hojas que no tenían. */
.rt-x {
    position: absolute; top: 8px; right: 8px; z-index: 5;
    width: 44px; height: 44px; border-radius: 999px; border: 0; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: rgba(148, 163, 184, .16); color: inherit; font-size: 20px; line-height: 1;
}
.rt-x:active { opacity: .7; }

/* ── 5. Tablas anchas: desplazamiento con aviso ─────────────────────── */
/* table.rt-tabla-scroll = la tabla misma desplaza; .rt-desliza = su caja ya
   desplazaba. El aviso es un desvanecido en el borde por donde hay más
   (sirve en fondo claro y en el navy de la Consola). */
table.rt-tabla-scroll { display: block; overflow-x: auto !important; -webkit-overflow-scrolling: touch; max-width: 100%; }
.rt-desliza.rt-mas-der { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent); }
.rt-desliza.rt-mas-izq { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 34px), transparent); }
.rt-desliza.rt-mas-izq.rt-mas-der { -webkit-mask-image: linear-gradient(to right, transparent, #000 34px, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(to right, transparent, #000 34px, #000 calc(100% - 34px), transparent); }

/* ── 6. Teclado del celular ─────────────────────────────────────────── */
/* El JS pone --rt-teclado con lo que tapa el teclado; las barras fijas
   de abajo se esconden mientras se escribe para no montarse en el campo. */
html.rt-escribiendo .navppp-bottombar,
html.rt-escribiendo .rt-oculta-escribiendo { transform: translateY(110%); transition: transform .15s; }
html.rt-escribiendo .narco-widget:not(.narco-widget--abierto) { visibility: hidden; }

/* ── 7. Celular acostado (horizontal) ───────────────────────────────── */
@media (orientation: landscape) and (max-height: 500px) {
    /* La barra inferior ocupa 60 de 390 px: más baja, ícono y texto en línea. */
    .navppp-bottombar { height: 46px !important; }
    body { padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px)) !important; }
    .rt-hoja-panel { max-height: calc(100dvh - 8px) !important; }
}

/* ── 8. Pie de página y piezas comunes: zonas táctiles de 44 px ─────── */
@media (max-width: 767px) {
    #pr-footer a { display: inline-flex; align-items: center; min-height: 44px; }
    #pr-footer a[aria-label] { min-width: 44px; justify-content: center; }   /* redes sociales: solo ícono */
    #pr-footer ul, #pr-footer nav { row-gap: 0 !important; }
}

/* ── 9. Barra inferior que se esconde al bajar (Camilo, 18-nov) ────── */
.navppp-bottombar, [data-rt-barra] { transition: transform .22s cubic-bezier(.2, .8, .2, 1); will-change: transform; }
html.rt-barra-oculta .navppp-bottombar, html.rt-barra-oculta [data-rt-barra] { transform: translateY(calc(100% + 4px)); }

/* ── 10. Pie plegado en secciones en el celular (Camilo, 18-nov) ───── */
@media (max-width: 639px) {
    #pr-footer .rt-pie-sec { border-bottom: 1px solid rgba(255, 255, 255, .08); }
    #pr-footer .rt-pie-tit {
        display: flex !important; align-items: center; justify-content: space-between;
        min-height: 48px; margin: 0 !important; cursor: pointer; color: #C7CBDE !important;
        font-size: .72rem !important;
    }
    #pr-footer .rt-pie-tit::after {
        content: ""; width: 9px; height: 9px; margin-right: 4px;
        border-right: 2px solid #EEBE04; border-bottom: 2px solid #EEBE04;
        transform: rotate(45deg) translateY(-3px); transition: transform .2s;
    }
    #pr-footer .rt-pie-sec.rt-abierto .rt-pie-tit::after { transform: rotate(-135deg) translateY(-1px); }
    #pr-footer .rt-pie-sec:not(.rt-abierto) > ul { display: none !important; }
    #pr-footer .rt-pie-sec.rt-abierto > ul { padding-bottom: .6rem !important; }
    #pr-footer .footer-grid { gap: 0 !important; }
}

/* ══ Zona 7 · Militante ═══════════════════════════════════════════════ */
/* /militantes/carnet: en el celular los dos carnets quedaban diminutos lado a
   lado y las fichas cortaban palabras. Ahora: carrusel Frente/Reverso con
   «asomo» del siguiente (se desliza con el dedo) y fichas en 2 columnas. */
@media (max-width: 639px) {
    .mil-caras { display: flex !important; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px !important;
        margin: 0 -16px; padding: 22px 16px 6px !important; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .mil-caras::-webkit-scrollbar { display: none; }
    .mil-caras > figure { flex: 0 0 86%; scroll-snap-align: center; min-width: 0; }
    .mil-datos { grid-template-columns: 1fr 1fr !important; gap: 10px !important; padding-top: 18px !important; }
    .mil-dato.oro { grid-column: 1 / -1; }
    .mil-dato .v { font-size: 17px !important; overflow-wrap: anywhere; line-height: 1.2; }
    .mil-btns { width: 100%; display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
    .mil-btns .mil-b { justify-content: center; min-height: 48px; font-size: 14px; white-space: nowrap; padding-inline: 10px; }
}

/* Campos de fecha y hora: en iPhone/Android traen un ancho mínimo propio que
   rompe las rejillas de 2 columnas (p. ej. Fecha · Hora en «Crear formulario»). */
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] { min-width: 0; max-width: 100%; }
@media (max-width: 639px) {
    .fa-rej > *, .fa-rej2 > *, .fa-plant > * { min-width: 0; }
}


/* ══ Zona 9 · Consola ═════════════════════════════════════════════════ */
@media (max-width: 639px) {
    /* Pie del modal único de la Consola: el texto arriba a todo lo ancho,
       los botones abajo repartidos (no se aprieta «Al guardar se abre…»). */
    .sc-modal-f { flex-wrap: wrap; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom, 0px)) !important; }
    .sc-modal-f > small, .sc-modal-f > p, .sc-modal-f > span:not(.sc-sp) { flex: 1 0 100%; }
    .sc-modal-f .sc-sp { display: none; }
    .sc-modal-f > .sc-b, .sc-modal-f > button { flex: 1 1 0; min-height: 48px; justify-content: center; }
    .sc-modal-h { padding-top: .4rem !important; }
}
.rt-agarre.rt-agarre-osc::before { background: rgba(255, 255, 255, .38); }

/* ══ Zonas 1 y 4 · Inicio, muro y foro ════════════════════════════════ */
/* Íconos y botones chicos (28 px) del muro y del foro: el área que se puede
   tocar crece a 44 px con un ::after invisible, sin mover el diseño. */
@media (pointer: coarse) {
    .mu-ic, .mu-rel, .mf-rep, .fcp-more, .he-redes-mini-item, .hp-bar-mas { position: relative; }
    .mu-ic::after, .mu-rel::after, .mf-rep::after, .fcp-more::after, .he-redes-mini-item::after, .hp-bar-mas::after {
        content: ""; position: absolute; inset: -8px; border-radius: inherit;
    }
}

/* ── 11. Respuesta inmediata y transiciones ─────────────────────────── */
/* Botón esperando al servidor: se atenúa (con un respiro de 120 ms para no
   parpadear en respuestas rápidas) y no admite doble toque. */
.rt-cargando { pointer-events: none; cursor: progress; opacity: .62; transition: opacity .12s ease .12s; }
/* Paso suave entre páginas (Chrome/Safari recientes; el resto, como hoy). */
@media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
    ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
}

/* «MODERAR» (#mp): lo lleva la sesión de Moderación en su propio paquete (19-nov). */

/* Barra inferior propia de la Consola (Camilo, 18-nov). Solo celular. */
.rt-cbar { display: none; }
@media (max-width: 767px) {
    html.rt-consola .navppp-bottombar { display: none !important; }
    .rt-cbar {
        display: grid !important; grid-template-columns: repeat(5, 1fr); align-items: end;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 62;
        height: calc(62px + env(safe-area-inset-bottom, 0px)); padding: 0 4px env(safe-area-inset-bottom, 0px);
        background: #00082B; border-top: 1px solid rgba(238, 190, 4, .28);
        box-shadow: 0 -10px 28px rgba(0, 8, 43, .28);
    }
    .rt-cbar__i {
        position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        height: 62px; min-width: 44px; color: rgba(255, 255, 255, .72); text-decoration: none; background: none; border: 0;
        font-family: inherit; font-size: 10px; font-weight: 800; line-height: 1.1; letter-spacing: .04em; text-transform: uppercase; cursor: pointer;
    }
    .rt-cbar__i svg { width: 22px; height: 22px; }
    .rt-cbar__i.is-act, .rt-cbar__i:active { color: #EEBE04; }
    .rt-cbar__n {
        position: absolute; top: 6px; left: 50%; margin-left: 4px; font-style: normal; font-size: 10px; font-weight: 900;
        min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; border-radius: 999px; background: #DC2626; color: #fff;
        box-shadow: 0 0 0 2px #00082B;
    }
    .rt-cbar__aro {
        width: 50px; height: 50px; margin-top: -22px; border-radius: 999px; display: flex; align-items: center; justify-content: center;
        background: linear-gradient(135deg, #C48914, #EEBE04 60%, #FFB517); color: #00082B; box-shadow: 0 6px 18px rgba(196, 137, 20, .45), 0 0 0 4px #00082B;
    }
    .rt-cbar__c { color: #fff; }
    html.rt-consola body { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important; }
    html.rt-consola .narco-widget { bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; }
}
@media (orientation: landscape) and (max-height: 500px) {
    .rt-cbar { height: calc(48px + env(safe-area-inset-bottom, 0px)); }
    .rt-cbar__i { height: 48px; flex-direction: row; gap: 6px; }
    .rt-cbar__aro { width: 38px; height: 38px; margin-top: 0; }
}

/* Hoja «Áreas» de la Consola (la arma el JS con la cinta de la página). */
.rt-areas-velo { position: fixed; inset: 0; z-index: 9995; background: rgba(0, 8, 43, .55); }
.rt-areas {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 9996; max-height: 86dvh; overflow-y: auto;
    background: #00082B; color: #fff; border-radius: 20px 20px 0 0; border-top: 1px solid rgba(238, 190, 4, .3);
    padding: 0 16px calc(18px + env(safe-area-inset-bottom, 0px)); animation: rt-sube .26s cubic-bezier(.2, .8, .2, 1);
}
.rt-areas h2 { margin: 2px 0 10px; font-size: 13px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: #EEBE04; }
.rt-areas details { border-top: 1px solid rgba(255, 255, 255, .08); }
.rt-areas summary {
    list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 50px;
    font-size: 15px; font-weight: 800; cursor: pointer;
}
.rt-areas summary::-webkit-details-marker { display: none; }
.rt-areas summary::after { content: "›"; font-size: 22px; color: #EEBE04; transition: transform .2s; }
.rt-areas details[open] summary::after { transform: rotate(90deg); }
.rt-areas details.on summary { color: #EEBE04; }
.rt-areas .rt-areas-g { margin: 6px 0 2px; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .5); }
.rt-areas a { display: flex; align-items: center; min-height: 44px; padding: 0 10px; margin: 0 -10px; border-radius: 10px; color: rgba(255, 255, 255, .88); text-decoration: none; font-size: 15px; }
.rt-areas a.on { background: rgba(238, 190, 4, .12); color: #EEBE04; font-weight: 800; }
.rt-areas a:active { background: rgba(255, 255, 255, .08); }

/* ══ Zona 8 · Equipo, vocería y territorio ════════════════════════════ */
/* Celular acostado: el panel de vocería dejaba ~160 px útiles entre la
   cabecera, la hoja «Hoy», el botón «Mi vocería» y la barra. */
@media (orientation: landscape) and (max-height: 500px) {
    .gt-acts:not(.jv-acts) > .vt { transform: scale(.82); transform-origin: left bottom; }
    .gt-acts .hoy .hoy-p { max-height: 62vh !important; left: auto !important; width: min(420px, 55vw) !important; }
}
@media (max-width: 400px) {
    /* insignia de la acción del encabezado: se salía 5 px por la derecha a 360 */
    .gt-act-n { right: -2px !important; }
}
@media (max-width: 639px) {
    /* selector segmentado (Todos · Departamentales · Municipales…) en filtros:
       desliza de lado en vez de sacar la página de su ancho */
    .pm-seg { max-width: 100%; min-width: 0; overflow-x: auto; flex-wrap: nowrap !important; scrollbar-width: none; }
    .pm-seg::-webkit-scrollbar { display: none; }
    .pm-seg > * { flex: 0 0 auto; }
}

/* Consola › Analítica: la fila de rangos y el formulario de fechas libres
   empujaban 12 px de más a 360. */
@media (max-width: 639px) {
    .an-rangos, .an-libre { max-width: 100%; min-width: 0; }
    .an-libre input { min-width: 0; flex: 1 1 0; }
}

/* Consola a 360: rejillas de una columna con pista fija más ancha que la
   pantalla (Equipo, Formularios de Jóvenes), selectores segmentados y
   barras de acciones que se salían. */
@media (max-width: 639px) {
    .e2-dos, .fx-rej { grid-template-columns: minmax(0, 1fr) !important; }
    .e2-card, .fx-c { min-width: 0; }
    .sc-seg, .in-nav { max-width: 100%; min-width: 0; overflow-x: auto; flex-wrap: nowrap !important; scrollbar-width: none; }
    .sc-seg::-webkit-scrollbar, .in-nav::-webkit-scrollbar { display: none; }
    .sc-seg > *, .in-nav > * { flex: 0 0 auto; }
    .pm-busca { flex-wrap: wrap; }
    .pm-busca > .pm-b { flex: 1 1 100%; justify-content: center; min-height: 48px; }
}

/* ── 12. Hojas que nacen abajo desde el primer cuadro (19-nov) ──────── */
/* Caso de Camilo: «abre a la mitad flash y después sí sale abajo». La regla
   es: la posición de hoja la decide el CSS por media query, nunca el JS
   después de pintar. Tokens comunes (acordados con la Lupa): */
:root { --rt-dur: 240ms; --rt-curva: cubic-bezier(.22, .8, .24, 1); --rt-velo: rgba(0, 8, 43, .55); }
@media (max-width: 639px), (orientation: landscape) and (max-height: 500px) {
    /* Modal único de la Consola (x-consola.modal): hoja por CSS puro. */
    .sc-ov { align-items: flex-end !important; justify-content: center !important; padding: 0 !important; }
    .sc-ov .sc-modal {
        width: min(100%, 760px) !important; max-width: none !important; margin: 0 !important;
        border-radius: 20px 20px 0 0 !important; max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px)) !important;
        padding-bottom: env(safe-area-inset-bottom, 0px); animation: rt-sube var(--rt-dur) var(--rt-curva) both;
    }
    .sc-ov .sc-ov-bg { animation: rt-velo var(--rt-dur) ease both; }
    .rt-hoja-panel { animation: rt-sube var(--rt-dur) var(--rt-curva) both !important; }
}
@keyframes rt-velo { from { opacity: 0; } to { opacity: 1; } }
/* La entrada desde abajo es desde fuera de la pantalla, no desde la mitad. */
@keyframes rt-sube { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .sc-ov .sc-modal, .sc-ov .sc-ov-bg, .rt-hoja-panel { animation: none !important; } }
/* La agarradera va superpuesta: insertarla ya no empuja el contenido. */
.rt-agarre { position: absolute !important; top: 0; left: 0; right: 0; z-index: 4; height: 20px; }
