/*
 * responsive.css — Sistema Escuela de Liderazgo
 * Estilos globales de responsividad compartidos por todos los templates
 * =======================================================================
 */

/* ════════════ RESET Y BASE ════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; }

input, select, textarea, button {
    font-family: inherit;
    font-size: 1rem; /* evita zoom automático en iOS (mínimo 16px) */
    border-radius: 8px;
}

/* En iOS, inputs con font-size < 16px provocan zoom automático */
@supports (-webkit-touch-callout: none) {
    input, select, textarea { font-size: 16px !important; }
}

/* ════════════ TABLAS RESPONSIVE ═══════════════════════════════════════ */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
}

.table-wrap table {
    min-width: 580px; /* fuerza scroll horizontal en móvil */
    width: 100%;
    border-collapse: collapse;
}

/* ════════════ SIDEBAR / PANEL CON SIDEBAR ══════════════════════════════ */
/* Los paneles grandes (admin, rrhh, operador) usan .main-layout o similar */
@media (max-width: 768px) {
    /* Ocultar sidebar lateralmente, toggle con botón */
    .sidebar {
        position: fixed !important;
        left: -280px !important;
        top: 0 !important;
        height: 100vh !important;
        z-index: 1000 !important;
        transition: left .3s ease !important;
        box-shadow: 4px 0 20px rgba(0,0,0,.4) !important;
    }
    .sidebar.open { left: 0 !important; }

    /* Content ocupa todo el ancho */
    .main-content, .content, .content-area {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 12px !important;
    }

    /* Overlay cuando sidebar está abierto */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 999;
    }
    .sidebar-overlay.active { display: block; }

    /* Topbar visible en móvil */
    .topbar { display: flex !important; }

    /* Cards apiladas */
    .stats-grid, .cards-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
}

@media (max-width: 480px) {
    .stats-grid, .cards-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ════════════ FORMULARIOS RESPONSIVOS ══════════════════════════════════ */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 540px) {
    .form-row { grid-template-columns: 1fr !important; }
}

/* Botones que deben ocupar ancho completo en móvil */
@media (max-width: 480px) {
    .btn-row { flex-direction: column; }
    .btn-row .btn { width: 100%; justify-content: center; }
}

/* ════════════ LOGIN CARDS ══════════════════════════════════════════════ */
.login-container, .box {
    width: 92% !important;
    max-width: 440px !important;
    padding: 28px 20px !important;
}

@media (max-width: 360px) {
    .login-container, .box {
        padding: 20px 14px !important;
    }
}

/* ════════════ SEARCH ROW ═══════════════════════════════════════════════ */
.search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.search-row input[type="text"],
.search-row input[type="search"] {
    flex: 1;
    min-width: 120px;
}

/* ════════════ BADGES / CHIPS ═══════════════════════════════════════════ */
.badge-e, .badge-s, .badge-sin, .badge-dept, .badge-cargo {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

/* ════════════ CARD HEADS ═══════════════════════════════════════════════ */
.card-head {
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 600px) {
    .card-head {
        flex-direction: column;
        align-items: flex-start !important;
    }
    .card-head h3 { font-size: .95rem; }
}

/* ════════════ MODALES ══════════════════════════════════════════════════ */
.modal-box {
    width: 95vw !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    padding: 20px 16px !important;
}

/* ════════════ TOPBAR MOBILE MENU TOGGLE ════════════════════════════════ */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .menu-toggle { display: inline-flex !important; align-items: center; }
}

/* ════════════ TIPOGRAFIA ADAPTATIVA ═══════════════════════════════════ */
@media (max-width: 480px) {
    h1 { font-size: 1.3rem !important; }
    h2 { font-size: 1.1rem !important; }
    h3 { font-size: 1rem !important; }
    .topbar h1 { font-size: 1rem !important; }
}

/* ════════════ TABLA DE ACCIONES — BOTONES COMPACTOS ══════════════════ */
@media (max-width: 600px) {
    table td:last-child { white-space: nowrap; }
    .btn-sm { padding: 4px 7px !important; font-size: .68rem !important; }
}

/* ════════════ COLORES COMUNES (COMPARTIDOS) ═══════════════════════════ */
.btn-cyan {
    background: rgba(6,182,212,.15);
    border: 1px solid rgba(6,182,212,.3);
    color: #67e8f9;
}
.btn-cyan:hover { background: rgba(6,182,212,.25); }

.btn-red {
    background: rgba(239,68,68,.15);
    border: 1px solid rgba(239,68,68,.3);
    color: #fca5a5;
}
.btn-red:hover { background: rgba(239,68,68,.25); }

/* ════════════ SCROLL SUAVE ════════════════════════════════════════════ */
html { scroll-behavior: smooth; }

/* ════════════ FOCUS VISIBLE (ACCESIBILIDAD) ═══════════════════════════ */
:focus-visible {
    outline: 2px solid rgba(139,92,246,.6);
    outline-offset: 2px;
}

/* ════════════ PRINT BÁSICO ════════════════════════════════════════════ */
@media print {
    .sidebar, .menu-toggle, .topbar, .no-print { display: none !important; }
    body { background: white; color: black; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}
