/* =====================================================================
   DISEÑO MOVIL - Sistema de Seguimiento de Titulados ISTLT
   Se aplica SOLO en pantallas de hasta 768px.
   ===================================================================== */

/* =====================================================================
   BOTON HAMBURGUESA (base - oculto en escritorio)
   OJO: debe ir ANTES del media query para que este pueda sobreescribirlo.
   ===================================================================== */

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-azul-marino);
    font-size: 1.35rem;
    cursor: pointer;
    padding: 0;
    border-radius: 8px;
    margin-left: auto;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
    flex-shrink: 0;
}
.menu-toggle:hover { background: var(--color-fondo-gris); }
.menu-toggle:focus {
    outline: 2px solid var(--color-azul-marino);
    outline-offset: 2px;
}


/* =====================================================================
   REGLAS MOVILES
   ===================================================================== */

@media (max-width: 768px) {

    /* ---------- MOSTRAR BOTON HAMBURGUESA ---------- */
    .menu-toggle {
        display: inline-flex;
    }

    /* ---------- BASE ---------- */
    html { font-size: 15px; }
    body {
        font-size: 1rem;
        line-height: 1.5;
    }

    /* Evita zoom automatico en iOS al enfocar inputs */
    input, select, textarea {
        font-size: 16px !important;
    }

    /* ---------- CONTENEDORES ---------- */
    :root {
        --padding-lateral: 0.75rem;
        --radio-borde: 8px;
    }
    .seccion {
        padding: 0.85rem 0.75rem;
    }
    .avisos-flash-contenedor {
        padding: 0 0.75rem !important;
        margin-top: 0.5rem !important;
    }

    /* ---------- HEADER ---------- */
    .cabecera {
        padding: 0.4rem 0;
    }
    .cabecera__contenedor {
        padding: 0 0.75rem;
        flex-wrap: nowrap;
        gap: 0.5rem;
        position: relative;
    }
    .cabecera__logo img {
        height: 34px !important;
    }

    /* Nav se convierte en panel desplegable */
    .cabecera__contenedor nav {
        display: none;
        position: absolute;
        top: calc(100% + 0.4rem);
        left: 0.5rem;
        right: 0.5rem;
        background: white;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin: 0;
        padding: 0.4rem;
        border-radius: 10px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
        max-height: 70vh;
        overflow-y: auto;
        z-index: 200;
    }
    .cabecera__contenedor nav.abierto {
        display: flex;
    }
    .cabecera__contenedor nav a:not(.boton) {
        padding: 0.75rem 0.9rem;
        font-size: 0.92rem;
        border-radius: 8px;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 0.6rem;
    }
    .cabecera__contenedor nav a:not(.boton):hover,
    .cabecera__contenedor nav a:not(.boton):active {
        background: var(--color-fondo-gris);
    }
    .cabecera__contenedor nav a i {
        margin-right: 0;
        width: 1.2rem;
        text-align: center;
        flex-shrink: 0;
    }
    .cabecera__contenedor nav .boton {
        margin-top: 0.4rem;
        padding: 0.75rem 0.9rem;
        font-size: 0.92rem;
        justify-content: center;
    }

    /* ---------- BOTONES: area tactil minima 44px ---------- */
    .boton {
        padding: 0.7rem 1.1rem;
        font-size: 0.92rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
    }
    .boton--primario,
    .boton--secundario {
        padding: 0.7rem 0.9rem;
        font-size: 0.9rem;
        min-height: 44px;
    }
    .boton--pequeno {
        padding: 0.5rem 0.85rem;
        font-size: 0.82rem;
        min-height: 36px;
    }
    .boton-icono {
        width: 40px;
        height: 40px;
    }

    /* ---------- TITULOS ---------- */
    h1 { font-size: 1.35rem; }
    h2 { font-size: 1.15rem; }
    h3 { font-size: 1rem; }

    .titulo-con-acento {
        font-size: 1.05rem;
        margin-bottom: 0.3rem;
    }
    .subtitulo-seccion {
        font-size: 0.92rem;
        margin-bottom: 0.7rem;
    }
    .linea-acento {
        width: 50px;
        height: 3px;
        margin: 0.3rem 0 0.85rem;
    }

    /* ---------- HERO INGENIERO - compacto ---------- */
    .hero-ingeniero {
        padding: 0.85rem 0.9rem;
        border-radius: 0 0 14px 14px;
    }
    .hero-ingeniero h1 {
        font-size: 1.15rem;
        margin-bottom: 0.15rem;
    }
    .hero-ingeniero p {
        font-size: 0.78rem;
        margin: 0;
    }

    /* ---------- BANNER ---------- */
    .banner {
        padding: 1rem 0.9rem 0.9rem;
    }
    .banner h1 { font-size: 1.2rem; }
    .banner__migas { font-size: 0.78rem; }

    /* ---------- HERO PUBLICO ---------- */
    .hero-publico {
        padding: 1.25rem 0.9rem;
        border-radius: 0 0 18px 18px;
    }
    .hero-publico__contenedor {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    .hero-publico__contenido {
        text-align: center;
        order: 2;
    }
    .hero-publico__imagen {
        order: 1;
    }
    .hero-publico__imagen img {
        max-height: 180px;
        border-radius: 10px;
    }
    .hero-publico h1 {
        font-size: 1.35rem;
        margin-bottom: 0.7rem;
    }
    .hero-publico p.descripcion {
        font-size: 0.85rem;
        margin-bottom: 1rem;
        line-height: 1.55;
    }
    .hero-publico__badge {
        font-size: 0.68rem;
        padding: 4px 11px;
        margin-bottom: 0.7rem;
        letter-spacing: 0.5px;
    }
    .hero-publico__acciones {
        justify-content: center;
        flex-direction: column;
        gap: 0.5rem;
    }
    .boton-ingresar,
    .boton-secundario {
        width: 100%;
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
        min-height: 44px;
    }

    /* ---------- KPI DASHBOARD - tarjetas muy compactas ---------- */
    .kpi-grid {
        gap: 0.55rem;
        justify-content: stretch;
    }
    .kpi-card {
        flex: 1 1 100%;
        min-width: 0;
        padding: 0.7rem 0.85rem;
        border-radius: 10px;
        gap: 0.7rem;
        border-left-width: 4px;
    }
    .kpi-card__icono {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
        border-radius: 9px;
    }
    .kpi-card__numero {
        font-size: 1.2rem;
        line-height: 1.05;
    }
    .kpi-card__etiqueta {
        font-size: 0.72rem;
        line-height: 1.2;
    }

    /* ---------- GRAFICO ---------- */
    .grafico-tarjeta {
        padding: 0.9rem;
        border-radius: 12px;
    }

    /* ---------- TOOLBAR DE LISTAS ---------- */
    .lista-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        margin-bottom: 0.9rem;
    }
    .lista-toolbar__buscar {
        flex-direction: column;
        gap: 0.45rem;
    }
    .lista-toolbar__buscar input {
        min-width: 0;
        width: 100%;
        padding: 0.65rem 0.85rem 0.65rem 2.2rem;
        font-size: 0.88rem;
    }
    .lista-toolbar__buscar button {
        width: 100%;
    }

    /* ---------- TABS ---------- */
    .tabs-titulados,
    .tabs-seccion {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.2rem;
    }
    .tabs-titulados::-webkit-scrollbar,
    .tabs-seccion::-webkit-scrollbar {
        display: none;
    }
    .tabs-titulados a {
        padding: 0.6rem 0.85rem;
        font-size: 0.8rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .tab-seccion {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .tab-seccion .contador {
        font-size: 0.66rem;
        padding: 1px 6px;
    }

    /* ---------- FILTROS ---------- */
    .filtros-form {
        flex-direction: column;
        gap: 0.45rem;
        margin-bottom: 0.9rem;
    }
    .filtros-form select,
    .filtros-form input {
        width: 100%;
        padding: 0.65rem 0.85rem;
        font-size: 0.88rem;
    }

    /* ---------- FORMULARIOS ---------- */
    .formulario {
        max-width: 100%;
    }
    .formulario input,
    .formulario select,
    .formulario textarea,
    .input-form {
        padding: 0.65rem 0.85rem;
        font-size: 1rem;
    }

    /* Grids inline de 3 columnas en templates -> 1 columna */
    div[style*="grid-template-columns:1fr 1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr 1fr"] {
        display: block !important;
    }
    div[style*="grid-template-columns:1fr 1fr 1fr"] > p,
    div[style*="grid-template-columns: 1fr 1fr 1fr"] > p {
        margin-bottom: 0.65rem;
    }

    /* ---------- TABLAS ---------- */
    .tabla-elegante-wrap {
        border-radius: 10px;
        overflow: hidden;
    }
    .tabla-scroll {
        max-height: 60vh;
        border-radius: 0;
        margin-top: 0.4rem;
    }
    .tabla-scroll::after {
        content: "\2190 desliza \2192";
        display: block;
        text-align: center;
        font-size: 0.68rem;
        color: #999;
        padding: 0.35rem;
        background: linear-gradient(to top, white 60%, rgba(255, 255, 255, 0));
        position: sticky;
        bottom: 0;
        pointer-events: none;
    }
    .tabla-elegante {
        font-size: 0.8rem;
        min-width: 600px;
    }
    .tabla-elegante th {
        padding: 0.5rem 0.55rem;
        font-size: 0.66rem;
    }
    .tabla-elegante td {
        padding: 0.5rem 0.55rem;
        font-size: 0.8rem;
    }
    .tabla-elegante td input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
    .fila-persona { gap: 0.4rem; }
    .fila-persona__avatar {
        width: 26px;
        height: 26px;
        font-size: 0.68rem;
    }
    .acciones-fila {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    .acciones-fila a,
    .acciones-fila button {
        font-size: 0.76rem;
    }

    /* ---------- BADGES ---------- */
    .badge-estado {
        padding: 2px 8px;
        font-size: 0.66rem;
    }
    .codigo-carrera {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
    .contador-titulados {
        font-size: 0.74rem;
        padding: 3px 9px;
    }

    /* ---------- AVISOS ---------- */
    .aviso-informativo {
        padding: 0.65rem 0.8rem;
        font-size: 0.82rem;
        border-radius: 9px;
        gap: 0.5rem;
    }
    .aviso-informativo i { font-size: 0.95rem; }
    .aviso-borrador {
        padding: 0.45rem 0.75rem;
        font-size: 0.8rem;
        display: block;
        width: 100%;
    }

    /* ---------- ENCUESTA FILA ---------- */
    .encuestas-lista { gap: 0.45rem; }
    .encuesta-fila {
        padding: 0.75rem 0.85rem;
        gap: 0.5rem;
        border-radius: 9px;
    }
    .encuesta-fila__titulo { font-size: 0.85rem; }
    .encuesta-fila__meta { font-size: 0.75rem; }
    .encuesta-fila__estado {
        font-size: 0.63rem;
        padding: 2px 7px;
    }

    /* ---------- FORM AGREGAR PREGUNTA ---------- */
    .form-agregar {
        padding: 0.75rem 0.85rem;
        border-radius: 9px;
        margin-bottom: 0.9rem;
    }

    /* ---------- RESPONSABLE CARD (publico) ---------- */
    .responsable-card {
        flex-direction: column;
        text-align: center;
        padding: 1.25rem 0.9rem;
        gap: 0.85rem;
        border-radius: 12px;
        border-left-width: 4px;
    }
    .responsable-card__foto img {
        width: 110px;
        height: 110px;
        border-width: 4px;
    }
    .responsable-card__info { text-align: center; }
    .responsable-card__nombre { font-size: 1.2rem; }
    .responsable-card__cargo { font-size: 0.85rem; }

    /* ---------- INFO CARDS (publico) ---------- */
    .info-cards {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .info-card {
        padding: 1.1rem 0.9rem;
        border-radius: 12px;
    }
    .info-card h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    .info-card p,
    .info-card ol { font-size: 0.88rem; }

    /* ---------- STATS GRID (publico) ---------- */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }
    .stat-card {
        padding: 1rem 0.7rem;
        border-radius: 11px;
        border-top-width: 4px;
    }
    .stat-card__numero {
        font-size: 1.65rem;
        margin-bottom: 0.3rem;
    }
    .stat-card__etiqueta { font-size: 0.7rem; }

    /* ---------- CARRERAS GRID (publico) ---------- */
    .carreras-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .carrera-card {
        padding: 0.9rem;
        border-radius: 11px;
    }
    .carrera-card__nombre { font-size: 0.85rem; }
    .carrera-card__badge {
        font-size: 0.7rem;
        padding: 3px 9px;
    }
    .mayor-demanda {
        font-size: 0.88rem;
        padding: 0.75rem 0.9rem;
        margin-top: 1rem;
    }

    /* ---------- CTA FINAL (publico) ---------- */
    .cta-final { padding: 1.75rem 0.9rem; }
    .cta-final h2 { font-size: 1.2rem; }
    .cta-final p {
        font-size: 0.88rem;
        margin-bottom: 1rem;
    }

    /* ---------- PIE ---------- */
    .pie {
        padding: 0.75rem 0.9rem;
        font-size: 0.75rem;
    }

    /* ---------- DETAILS / SUMMARY ---------- */
    details summary { font-size: 0.88rem; }

    /* ---------- BLOQUES INSTITUCIONALES (publico) ---------- */
    .bloques-institucionales {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .bloque { padding: 1rem; }
    .bloque h3 { font-size: 1rem; }

    /* ---------- TARJETAS DE ESTADISTICA (publico) ---------- */
    .tarjetas-estadisticas {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }
    .tarjeta-estadistica { padding: 0.9rem 0.7rem; }
    .tarjeta-estadistica__numero { font-size: 1.5rem; }
    .tarjeta-estadistica__etiqueta { font-size: 0.72rem; }
}