/* ==========================================================================
   1. CONFIGURACIÓN GENERAL Y RESET
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
}

body {
    min-height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    font-size: 16px;
}


/* ==========================================================================
   2. LAYOUT Y CONTENEDORES
   ========================================================================== */

/* --- Clases de Layout para el <body> --- */
body.layout-centered {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}
body.layout-default {
    display: block;
}

/* --- Contenedor Principal --- */
.container {
    width: 95%;
    max-width: 1100px; /* Ancho por defecto para páginas de gestión */
    margin: 30px auto;
    padding: 20px;
    box-sizing: border-box;
}
.container.container-narrow { max-width: 450px; } /* Para login */
.container.container-medium { max-width: 800px; } /* Para index */

/* --- Contenedores de contenido (cajas blancas) --- */
.selection-container, .reports-container, .management-panel {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 25px;
    margin-bottom: 20px;
    width: 100%;
    text-align: left;
}


/* ==========================================================================
   3. ELEMENTOS COMUNES (Cabeceras, Títulos, Logo)
   ========================================================================== */
.logo {
    display: block;
    margin: 0 auto 40px auto;
    max-width: 250px;
    height: auto;
}
h1 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}
.welcome-header {
    background-color: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #eee;
}
.welcome-header span {
    font-size: 1.1rem;
    color: #333;
}
.welcome-header a {
    background-color: #e74c3c;
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    font-size: 0.9rem;
}
.welcome-header a:hover {
    background-color: #c0392b;
}
.step {
    margin-bottom: 25px;
}
.step-title {
    font-size: 1.1rem;
    color: #7f8c8d;
    margin-bottom: 12px;
    font-weight: 500;
}


/* ==========================================================================
   4. BOTONES
   ========================================================================== */

/* --- Grids de Botones --- */
.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.options-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

/* --- Tipos de Botones --- */
.btn { /* Botones principales grandes */
    display: block;
    padding: 18px 20px;
    background-color: #0056b3;
    color: white;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.2s;
}
.btn:hover {
    background-color: #004085;
}
.btn:active {
    transform: scale(0.98);
}

.option-btn { /* Botones de selección de pasos */
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    text-align: center;
    min-width: 120px;
    text-decoration: none;
    display: inline-block;
}
.option-btn:hover { background: #2980b9; }
.option-btn.selected { background: #2ecc71; font-weight: bold; }

.depto-btn { /* Botones de departamento */
    background: #34495e;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    min-width: 80px;
    display: inline-block;
    margin: 3px;
}
.depto-btn:hover { background: #2c3e50; }
.depto-btn.selected { background: #9b59b6; font-weight: bold; }
.depto-btn.found { background-color: #2ecc71; }
.depto-btn.not-found { background-color: #e74c3c; }

/* Botones de acción (Editar, Eliminar con texto) */
.action-btn {
    display: inline-block;
    padding: 5px 10px;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    color: white;
    font-size: 0.9rem;
    text-decoration: none;
    margin-right: 5px;
}
.action-btn.edit { background-color: #ffc107; }
.action-btn.delete { background-color: #f44336; }

/* Botones de icono (Lápiz, Papelera) */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    vertical-align: middle;
    display: inline-block;
}
.icon-btn svg {
    width: 20px;
    height: 20px;
    color: #555;
    transition: color 0.2s;
}
.icon-btn:hover svg { color: #007bff; }
.icon-btn.delete:hover svg { color: #e74c3c; }


/* ==========================================================================
   5. TABLAS
   ========================================================================== */

/* Estilo mejorado para tablas de gestión (add_users, etc.) */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 1rem;
    text-align: left;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.admin-table th, .admin-table td {
    padding: 16px;
    vertical-align: middle;
    border-bottom: 1px solid #ddd;
}
.admin-table th {
    background-color: #f8f9fa;
}
.admin-table tbody tr:nth-child(even) {
    background-color: #e7f5ff; /* Celeste claro */
}
.admin-table tbody tr:hover {
    background-color: #d1ecff;
}

/* Tabla original de departamentos */
.deptos-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}
.deptos-table td {
    padding: 8px;
    text-align: center;
}


/* ==========================================================================
   6. FORMULARIOS Y MODALES
   ========================================================================== */

.form-group {
    margin-bottom: 15px;
    position: relative;
    text-align: left;
}
label {
    display: block;
    margin-bottom: 5px;
    color: #7f8c8d;
    font-size: 0.95rem;
}
input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="date"], select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

/* Modales */
.modal {
    display: none !important;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
}
.modal.is-active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    width: 95%;
    max-width: 700px;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
    padding-bottom: 15px;
    margin-bottom: 20px;
}
.close-btn {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.status-options {
    display: flex;
    align-items: center;
    gap: 15px;
}


/* ==========================================================================
   7. MENSAJES Y OTROS
   ========================================================================== */

.result-message, .session-message {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
}
.session-message.success { background-color: #d4edda; color: #155724; }
.session-message.error { background-color: #f8d7da; color: #721c24; }
.status-active { color: green; font-weight: bold; }
.status-inactive { color: red; font-weight: bold; }
.info-text { color: #17a2b8; font-size: 0.9rem; margin-top: 5px; }


/* ==========================================================================
   8. FOOTER
   ========================================================================== */
.site-footer {
    width: 100%;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid #e9ecef;
    color: #7f8c8d;
    font-size: 0.9rem;
}
.site-footer a { color: #3498db; text-decoration: none; margin: 0 10px; }
.site-footer a:hover { color: #2980b9; text-decoration: underline; }
.footer-icon { display: inline-block; vertical-align: middle; width: 16px; height: 16px; margin-right: 5px; }


/* ==========================================================================
   9. RESPONSIVE
   ========================================================================== */

   
   
@media (max-width: 600px) {
    .container {
        width: 100%;
        padding: 10px;
        margin: 10px auto;
    }

    body {
        font-size: 15px; /* Opcional: un poco más pequeño que en escritorio pero legible */
        -webkit-text-size-adjust: 100%; /* Evita que iOS agrande la fuente automáticamente */
    }

    /* --- AÑADE ESTA TAMBIÉN PARA LOS INPUTS --- */
    input, select, button {
        font-size: 16px; /* Evita el zoom automático molesto en iOS */
    }

    .button-grid, .roles-grid {
        grid-template-columns: 1fr;
    }
    .admin-table th, .admin-table td {
        padding: 10px;
    }
    .logo {
        max-width: 200px;
        margin-bottom: 30px;
    }
}