/* ==================================================================
   === ESTILOS GENERALES SISTEMA V.E.R.A. (Toolkit ESAN V4.1) ===
   ================================================================== */
/* --- 1. VARIABLES Y BASE --- */
:root {
    /* Colores Oficiales ESAN */
    --esan-red: #E3173E;       /* Rojo Institucional */
    --esan-dark: #273f59;      /* Azul Oscuro Institucional */
    --esan-gray: #696a6d;      /* Gris Texto Secundario */
    --esan-light: #f5f5f5;     /* Fondo General */
    
    /* Tipografías */
    --font-title: 'Bricolage Grotesque', sans-serif;
    --font-body: 'Inter', sans-serif;
    /* Estados Semánticos (Nuevos) */
    --color-success: #28a745;
    --bg-success: #d4edda;
    --color-warning: #ffc107;
    --bg-warning: #fff3cd;
    --color-danger: #dc3545;
    --bg-danger: #f8d7da;
}
body {
    font-family: var(--font-body);
    background-color: var(--esan-light);
    margin: 0;
    padding: 0;
    color: #333;
    line-height: 1.5;
}
h1, h2, h3, h4 {
    font-family: var(--font-title);
    color: var(--esan-red);
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}
a { text-decoration: none; color: var(--esan-red); }
a:hover { text-decoration: underline; }
/* Contenedor Principal (Privado) */
.container {
    max-width: 1000px; /* Ampliado para tablas */
    margin: 40px auto;
    background-color: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    position: relative;
}
/* Contenedor Público (Nuevo C1) */
.public-container {
    max-width: 700px;
    margin: 40px auto;
    background-color: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
/* LOGO ESAN (Cabecera Común) */
.container::before, .public-container::before {
    content: "";
    display: block;
    background-image: url('https://firebasestorage.googleapis.com/v0/b/vera-ff3cc.firebasestorage.app/o/LOGO_ESAN_1.png?alt=media&token=b3c2f914-04fc-40c2-bbf7-2a5a2099f59d');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: left center;
    height: 60px;
    margin-bottom: 30px;
}
/* --- 2. LAYOUT Y NAVEGACIÓN (TABS) --- */
.app-nav {
    max-width: 1200px;
    margin: 20px auto -30px auto;
    padding: 0 40px;
    display: flex;
    list-style: none;
    padding-left: 0;
    border-bottom: 2px solid #ddd;
}
/* Estilos para los Tabs (Pestañas) en Gestión */
.tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 20px;
    gap: 5px;
    overflow-x: auto;
}
.tab-link {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-family: var(--font-title);
    font-size: 15px;
    color: var(--esan-gray);
    transition: all 0.3s;
    white-space: nowrap;
}
.tab-link:hover { color: var(--esan-red); background-color: #f9f9f9; }
.tab-link.active {
    color: var(--esan-red);
    border-bottom-color: var(--esan-red);
    font-weight: bold;
}
.tab-content {
    animation: fadeIn 0.3s ease-in;
    padding: 10px 0;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
.header-module {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    margin-bottom: 20px;
}
.user-info { font-size: 0.9em; color: #888; }
/* --- 3. ESTILOS DE FORMULARIO --- */
.form-section-title { 
    color: var(--esan-red); 
    border-bottom: 1px solid #eee; 
    padding-bottom: 10px; 
    margin-top: 30px; 
    margin-bottom: 20px; 
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.row { display: flex; gap: 20px; margin-bottom: 15px; }
.col-md-6, .col-md-4 { flex: 1; }
label { 
    display: block; 
    font-weight: 600; 
    margin-bottom: 8px; 
    color: #444; 
    font-size: 13px;
}
input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="tel"], select, input[type="file"], textarea {
    width: 100%; 
    padding: 10px 12px; 
    border: 1px solid #ccc; 
    border-radius: 6px; 
    box-sizing: border-box; 
    font-size: 14px;
    font-family: var(--font-body);
    transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--esan-red);
    outline: none;
    box-shadow: 0 0 0 3px rgba(227, 23, 62, 0.1);
}
/* Botones */
.btn-submit, .btn-esan { 
    background-color: var(--esan-red); 
    color: white; 
    border: none;
    border-radius: 6px;
    padding: 12px 24px;
    font-weight: 600; 
    cursor: pointer; 
    width: 100%; 
    font-size: 15px;
    transition: background 0.2s;
}
.btn-submit:hover, .btn-esan:hover { background-color: #c0001a; }
.btn-secondary { 
    padding: 10px 20px;
    border: 1px solid #ccc;
    background-color: white;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}
.btn-secondary:hover { background-color: #f0f0f0; }
.btn-refresh {
    background: white;
    border: 1px solid var(--esan-red);
    color: var(--esan-red);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}
.btn-refresh:hover { background: var(--esan-red); color: white; }
/* Botones de Icono (Para Tablas) */
.action-buttons { display: flex; gap: 5px; justify-content: center; }
.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.btn-icon:hover { transform: scale(1.1); }
.btn-icon.success { background: var(--bg-success); color: var(--color-success); }
.btn-icon.warning { background: var(--bg-warning); color: #856404; }
.btn-icon.danger { background: var(--bg-danger); color: var(--color-danger); }
/* --- 4. TABLAS V.E.R.A. (ACORDEÓN) --- */
.vera-table-container { overflow-x: auto; margin-top: 15px; }
.vera-table { 
    width: 100%; 
    border-collapse: separate; 
    border-spacing: 0; 
    margin-bottom: 30px; 
    font-family: var(--font-body);
}
.vera-table th { 
    background-color: #f8f9fa; 
    color: var(--esan-dark); 
    font-weight: 700; 
    padding: 12px 15px;
    text-align: left; 
    border-bottom: 2px solid var(--esan-red);
    font-size: 13px;
    text-transform: uppercase;
}
.vera-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    vertical-align: middle;
}
/* Fila Resumen (Clickable) */
.row-summary { 
    cursor: pointer; 
    transition: background 0.1s; 
}
.row-summary:hover { background-color: #fff0f2; }
/* Fila Detalle (Oculta por defecto) */
.row-detail { background-color: #fafafa; }
.row-detail td { padding: 0; border: none; }
.detail-content {
    padding: 20px;
    margin: 10px 20px;
    background: white;
    border-left: 4px solid var(--esan-red);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-radius: 0 6px 6px 0;
}
.detail-content ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-content li { font-size: 13px; color: #555; }
.detail-content strong { color: #333; }
/* --- 5. MODALES --- */
.modal-overlay { 
    display: none; 
    position: fixed; 
    z-index: 2000; 
    left: 0; top: 0; 
    width: 100%; height: 100%; 
    background-color: rgba(0,0,0,0.5); 
    backdrop-filter: blur(3px);
    justify-content: center;
    align-items: center;
}
/* EN STYLES.CSS */
.modal-content { 
    background-color: #fff; 
    padding: 30px; 
    border-radius: 12px; 
    width: 90%; 
    max-width: 500px; 
    box-shadow: 0 15px 40px rgba(0,0,0,0.2); 
    animation: slideUp 0.3s ease;
    
    /* --- AGREGA ESTA LÍNEA PARA CENTRAR --- */
    margin: 5% auto; /* 5% de separación arriba/abajo, AUTO a los lados (esto lo centra) */
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}
/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255,255,255,0.9);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
/* --- 6. HOME / DASHBOARD GRID --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    padding: 20px 0;
}
.dashboard-card {
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    color: #444;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 130px;  /* Reemplaza aspect-ratio: 1 / 1 — altura uniforme para todas las cards */
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(227, 23, 62, 0.15);
    border-color: var(--esan-red);
    text-decoration: none;
}
.dashboard-card i {
    font-size: 32px;
    margin-bottom: 15px;
    color: var(--esan-gray);
}
.dashboard-card:hover i { color: var(--esan-red); }
/* --- 7. RESPONSIVE --- */
@media (max-width: 768px) {
    .container { padding: 20px; margin: 20px; }
    .row { flex-direction: column; gap: 10px; }
    .detail-content ul { grid-template-columns: 1fr; }
}
/* --- 5. MODALES --- */
/* AGREGA ESTO AL INICIO DE LA SECCIÓN 5 */
.modal {
    display: none; /* ESTO ES LA CLAVE: Oculto por defecto */
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.5); /* Fondo oscuro */
    backdrop-filter: blur(3px); /* Efecto borroso */
}
/* ==================================================================
   === PARCHE DE CORRECCIÓN (Dashboard y Tablas) ===
   ================================================================== */
/* 1. Arreglar el contenedor para que quepan las tablas anchas */
.container {
    max-width: 1200px !important; /* Forzamos más ancho */
}
/* 2. Arreglar los Filtros (Que no ocupen 100% y estén en línea) */
.filters {
    display: flex;
    align-items: flex-end; /* Alineados abajo para coincidir con las letras */
    gap: 15px;
    background-color: #fff;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 25px;
    flex-wrap: wrap; /* Para que bajen en celulares */
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.filters label {
    margin-bottom: 5px;
    white-space: nowrap;
    font-weight: 700;
    color: #555;
}
/* IMPORTANTE: Esto corrige los selectores estirados */
.filters select {
    width: auto !important; /* Anula el 100% global */
    min-width: 180px;
    flex-grow: 1;
    background-color: #f9f9f9;
}
/* 3. Embellecer la Tabla (Que perdió los bordes) */
.vera-table { 
    width: 100%; 
    border-collapse: collapse !important; /* Une los bordes dobles */
    margin-bottom: 30px; 
    font-size: 14px;
    background: white;
    border: 1px solid #eee; /* Borde exterior */
}
.vera-table th { 
    background-color: #f8f9fa; 
    color: #b00020; /* Rojo ESAN */
    font-weight: 700; 
    padding: 15px;
    text-align: left; 
    border-bottom: 3px solid #b00020; /* Línea roja gruesa abajo del header */
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}
.vera-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee; /* Líneas sutiles entre filas */
    vertical-align: middle;
    color: #444;
}
.vera-table tr:hover { 
    background-color: #fff5f6; /* Un rosado muy sutil al pasar el mouse */
}
/* 4. Ajustar los Badges (Etiquetas de estado) */
.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
/* ==================================================================
   === PARCHE DE EMERGENCIA C3 (DASHBOARD ALQUILERES) ===
   ================================================================== */
/* 1. Solución para los Badges amontonados (A1, A2...) */
.badge-factura {
    display: inline-block; /* Esto permite que respeten los márgenes */
    margin-right: 5px !important; /* Espacio obligatorio entre etiquetas */
    margin-bottom: 3px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    cursor: help;
}
/* 2. Ajuste de espaciado para los iconos de acción en esta tabla específica */
.action-icons-spaced i {
    margin: 0 6px !important; /* Separa los ojos, lápices y prohibidos */
    cursor: pointer;
}