/**
 * ============================================================
 * RESERVA DARWIN - Hoja de Estilos Principal
 * ============================================================
 * Diseñado para máxima legibilidad y accesibilidad.
 * Usuario objetivo: Mujer de 63 años, nivel técnico bajo.
 * 
 * Principios:
 * - Fuentes grandes (16-18px mínimo)
 * - Botones de al menos 44px de altura
 * - Alto contraste (ratio WCAG AA mínimo)
 * - Colores claros y diferenciables
 * - Sin animaciones complejas
 * ============================================================
 */

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

:root {
    /* Paleta principal - Alto contraste */
    --color-primario: #1B5E20;       /* Verde oscuro (confianza, terrenos) */
    --color-primario-hover: #2E7D32;
    --color-primario-claro: #E8F5E9;
    --color-secundario: #0D47A1;     /* Azul oscuro */
    --color-secundario-hover: #1565C0;
    
    /* Estados */
    --color-exito: #2E7D32;
    --color-exito-fondo: #E8F5E9;
    --color-error: #C62828;
    --color-error-fondo: #FFEBEE;
    --color-advertencia: #E65100;
    --color-advertencia-fondo: #FFF3E0;
    --color-info: #0D47A1;
    --color-info-fondo: #E3F2FD;
    
    /* Fondos y textos */
    --color-fondo: #F5F5F5;
    --color-fondo-tarjeta: #FFFFFF;
    --color-texto: #212121;
    --color-texto-secundario: #424242;
    --color-borde: #BDBDBD;
    --color-borde-focus: #1B5E20;
    
    /* Tipografía */
    --fuente-principal: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --tamano-base: 17px;
    --tamano-grande: 20px;
    --tamano-titulo: 26px;
    --tamano-pequeno: 15px;
    
    /* Espaciado */
    --espacio-xs: 8px;
    --espacio-sm: 12px;
    --espacio-md: 20px;
    --espacio-lg: 32px;
    --espacio-xl: 48px;
    
    /* Bordes */
    --radio-borde: 8px;
    --radio-borde-grande: 12px;
    
    /* Sombras suaves */
    --sombra-suave: 0 2px 8px rgba(0,0,0,0.08);
    --sombra-media: 0 4px 16px rgba(0,0,0,0.12);
    
    /* Sidebar */
    --ancho-sidebar: 260px;
}

html {
    font-size: var(--tamano-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--fuente-principal);
    background-color: var(--color-fondo);
    color: var(--color-texto);
    line-height: 1.6;
    min-height: 100vh;
}

/* ─── TIPOGRAFÍA ─── */
h1 { font-size: 1.7rem; font-weight: 700; margin-bottom: var(--espacio-md); color: var(--color-texto); }
h2 { font-size: 1.4rem; font-weight: 600; margin-bottom: var(--espacio-sm); color: var(--color-texto); }
h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: var(--espacio-xs); }

p { margin-bottom: var(--espacio-sm); }

a {
    color: var(--color-secundario);
    text-decoration: underline;
    font-weight: 500;
}
a:hover { color: var(--color-secundario-hover); }

/* ─── LAYOUT PRINCIPAL ─── */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ─── SIDEBAR / MENÚ LATERAL ─── */
.sidebar {
    width: var(--ancho-sidebar);
    background: var(--color-primario);
    color: #fff;
    padding: var(--espacio-md);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    text-align: center;
    padding: var(--espacio-md) 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    margin-bottom: var(--espacio-md);
}

.sidebar-logo h1 {
    color: #fff;
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.sidebar-logo small {
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
}

.sidebar-nav {
    flex: 1;
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    border-radius: var(--radio-borde);
    font-size: 1.05rem;
    font-weight: 500;
    transition: background 0.2s;
    min-height: 48px;
}

.sidebar-nav a:hover,
.sidebar-nav a.activo {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.sidebar-nav a .nav-icono {
    font-size: 1.3rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-usuario {
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: var(--espacio-md);
    margin-top: auto;
}

.sidebar-usuario .usuario-info {
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    margin-bottom: var(--espacio-xs);
}

.sidebar-usuario a {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

/* ─── CONTENIDO PRINCIPAL ─── */
.contenido-principal {
    flex: 1;
    margin-left: var(--ancho-sidebar);
    padding: var(--espacio-lg);
    max-width: 1200px;
}

.pagina-encabezado {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--espacio-lg);
    flex-wrap: wrap;
    gap: var(--espacio-sm);
}

/* ─── TARJETAS / CARDS ─── */
.tarjeta {
    background: var(--color-fondo-tarjeta);
    border-radius: var(--radio-borde-grande);
    padding: var(--espacio-md);
    box-shadow: var(--sombra-suave);
    margin-bottom: var(--espacio-md);
}

.tarjeta-titulo {
    font-size: 1.1rem;
    color: var(--color-texto-secundario);
    margin-bottom: var(--espacio-xs);
    font-weight: 500;
}

.tarjeta-valor {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-texto);
}

.tarjeta-valor.positivo { color: var(--color-exito); }
.tarjeta-valor.advertencia { color: var(--color-advertencia); }
.tarjeta-valor.peligro { color: var(--color-error); }

/* Grid de tarjetas para dashboard */
.grid-tarjetas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--espacio-md);
    margin-bottom: var(--espacio-lg);
}

/* ─── TABLAS ─── */
.tabla-contenedor {
    overflow-x: auto;
    background: var(--color-fondo-tarjeta);
    border-radius: var(--radio-borde-grande);
    box-shadow: var(--sombra-suave);
}

.tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.tabla thead {
    background: var(--color-primario-claro);
}

.tabla th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--color-texto);
    border-bottom: 2px solid var(--color-borde);
    white-space: nowrap;
}

.tabla td {
    padding: 14px 16px;
    border-bottom: 1px solid #EEEEEE;
    vertical-align: middle;
}

.tabla tbody tr:hover {
    background: #F5F5F5;
}

.tabla .acciones {
    white-space: nowrap;
    display: flex;
    gap: 8px;
}

/* ─── BADGES / ETIQUETAS DE ESTADO ─── */
.estado {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.estado-disponible { background: #E8F5E9; color: #1B5E20; }
.estado-reservado  { background: #FFF3E0; color: #E65100; }
.estado-vendido    { background: #E3F2FD; color: #0D47A1; }
.estado-activa     { background: #E8F5E9; color: #1B5E20; }
.estado-anulada    { background: #FFEBEE; color: #C62828; }
.estado-pendiente  { background: #FFF3E0; color: #E65100; }
.estado-pagada     { background: #E8F5E9; color: #1B5E20; }
.estado-vencida    { background: #FFEBEE; color: #C62828; }

/* ─── BOTONES (Mínimo 44px de altura) ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radio-borde);
    font-family: var(--fuente-principal);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primario {
    background: var(--color-primario);
    color: #fff;
}
.btn-primario:hover { background: var(--color-primario-hover); color: #fff; }

.btn-secundario {
    background: var(--color-secundario);
    color: #fff;
}
.btn-secundario:hover { background: var(--color-secundario-hover); color: #fff; }

.btn-exito {
    background: var(--color-exito);
    color: #fff;
}
.btn-exito:hover { background: #388E3C; color: #fff; }

.btn-peligro {
    background: var(--color-error);
    color: #fff;
}
.btn-peligro:hover { background: #D32F2F; color: #fff; }

.btn-outline {
    background: transparent;
    color: var(--color-primario);
    border: 2px solid var(--color-primario);
}
.btn-outline:hover { background: var(--color-primario-claro); }

.btn-sm {
    min-height: 40px;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-lg {
    min-height: 56px;
    padding: 16px 32px;
    font-size: 1.15rem;
}

.btn-bloque {
    width: 100%;
}

/* ─── FORMULARIOS ─── */
.formulario {
    max-width: 700px;
}

.campo {
    margin-bottom: var(--espacio-md);
}

.campo label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-texto);
}

.campo .ayuda {
    display: block;
    font-size: 0.85rem;
    color: var(--color-texto-secundario);
    margin-top: 4px;
}

.campo input[type="text"],
.campo input[type="email"],
.campo input[type="password"],
.campo input[type="number"],
.campo input[type="date"],
.campo input[type="tel"],
.campo input[type="search"],
.campo select,
.campo textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border: 2px solid var(--color-borde);
    border-radius: var(--radio-borde);
    font-family: var(--fuente-principal);
    font-size: 1rem;
    color: var(--color-texto);
    background: #fff;
    transition: border-color 0.2s;
}

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
    outline: none;
    border-color: var(--color-borde-focus);
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.15);
}

.campo textarea {
    min-height: 100px;
    resize: vertical;
}

.campo select {
    appearance: auto;
}

.campo-error input,
.campo-error select,
.campo-error textarea {
    border-color: var(--color-error);
}

.campo-error .error-texto {
    color: var(--color-error);
    font-size: 0.9rem;
    margin-top: 4px;
}

.campo-fila {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--espacio-md);
}

.formulario-acciones {
    display: flex;
    gap: var(--espacio-sm);
    margin-top: var(--espacio-lg);
    padding-top: var(--espacio-md);
    border-top: 1px solid #eee;
}

/* Campo de contraseña con botón mostrar */
.campo-password {
    position: relative;
}

.campo-password input {
    padding-right: 56px;
}

.btn-mostrar-password {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--color-texto-secundario);
    min-height: auto;
}

/* ─── ALERTAS / MENSAJES FLASH ─── */
.alerta {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radio-borde);
    margin-bottom: var(--espacio-md);
    font-size: 1.05rem;
    font-weight: 500;
    animation: aparecerAlerta 0.3s ease-out;
}

@keyframes aparecerAlerta {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alerta-exito {
    background: var(--color-exito-fondo);
    color: var(--color-exito);
    border: 2px solid var(--color-exito);
}

.alerta-error {
    background: var(--color-error-fondo);
    color: var(--color-error);
    border: 2px solid var(--color-error);
}

.alerta-info {
    background: var(--color-info-fondo);
    color: var(--color-info);
    border: 2px solid var(--color-info);
}

.alerta-icono { font-size: 1.4rem; flex-shrink: 0; }
.alerta-texto { flex: 1; }
.alerta-cerrar {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    color: inherit;
}
.alerta-cerrar:hover { opacity: 1; }

/* ─── MODAL DE CONFIRMACIÓN ─── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.activo {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: var(--radio-borde-grande);
    padding: var(--espacio-lg);
    max-width: 500px;
    width: 90%;
    box-shadow: var(--sombra-media);
    text-align: center;
}

.modal h2 {
    margin-bottom: var(--espacio-md);
    color: var(--color-texto);
}

.modal p {
    font-size: 1.05rem;
    color: var(--color-texto-secundario);
    margin-bottom: var(--espacio-lg);
}

.modal-acciones {
    display: flex;
    gap: var(--espacio-sm);
    justify-content: center;
}

/* ─── BUSCADOR ─── */
.buscador {
    display: flex;
    gap: var(--espacio-sm);
    margin-bottom: var(--espacio-md);
    max-width: 500px;
}

.buscador input {
    flex: 1;
    min-height: 48px;
    padding: 12px 16px;
    border: 2px solid var(--color-borde);
    border-radius: var(--radio-borde);
    font-size: 1rem;
}

.buscador input:focus {
    outline: none;
    border-color: var(--color-borde-focus);
}

/* ─── PÁGINA DE LOGIN ─── */
.login-contenedor {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 50%, #388E3C 100%);
    padding: var(--espacio-md);
}

.login-tarjeta {
    background: #fff;
    border-radius: var(--radio-borde-grande);
    padding: var(--espacio-xl);
    width: 100%;
    max-width: 440px;
    box-shadow: var(--sombra-media);
}

.login-tarjeta h1 {
    text-align: center;
    color: var(--color-primario);
    margin-bottom: 4px;
}

.login-tarjeta .subtitulo {
    text-align: center;
    color: var(--color-texto-secundario);
    margin-bottom: var(--espacio-lg);
}

.login-tarjeta .campo {
    margin-bottom: var(--espacio-md);
}

.recordar-sesion {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: var(--espacio-md);
    cursor: pointer;
    font-size: 1rem;
}

.recordar-sesion input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--color-primario);
}

/* ─── VACÍO / SIN DATOS ─── */
.vacio {
    text-align: center;
    padding: var(--espacio-xl);
    color: var(--color-texto-secundario);
}

.vacio-icono {
    font-size: 3rem;
    margin-bottom: var(--espacio-sm);
    opacity: 0.5;
}

.vacio p {
    font-size: 1.1rem;
    margin-bottom: var(--espacio-md);
}

/* ─── UTILIDADES ─── */
.texto-derecha { text-align: right; }
.texto-centro { text-align: center; }
.texto-exito { color: var(--color-exito); }
.texto-error { color: var(--color-error); }
.texto-advertencia { color: var(--color-advertencia); }
.texto-secundario { color: var(--color-texto-secundario); }
.mt-sm { margin-top: var(--espacio-sm); }
.mt-md { margin-top: var(--espacio-md); }
.mb-md { margin-bottom: var(--espacio-md); }
.mb-lg { margin-bottom: var(--espacio-lg); }

/* Ocultar en pantalla (solo para lectores de pantalla) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.abierto {
        transform: translateX(0);
    }
    
    .contenido-principal {
        margin-left: 0;
        padding: var(--espacio-md);
    }
    
    .btn-menu-movil {
        display: flex;
        position: fixed;
        top: var(--espacio-sm);
        left: var(--espacio-sm);
        z-index: 101;
        background: var(--color-primario);
        color: #fff;
        border: none;
        width: 48px;
        height: 48px;
        border-radius: var(--radio-borde);
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        cursor: pointer;
    }
    
    .campo-fila {
        grid-template-columns: 1fr;
    }
    
    .pagina-encabezado {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .grid-tarjetas {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) {
    .btn-menu-movil {
        display: none;
    }
}

/* ─── DETALLE DE VENTA ─── */
.detalle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--espacio-md);
    margin-bottom: var(--espacio-lg);
}

.detalle-item {
    padding: var(--espacio-sm);
}

.detalle-item .etiqueta {
    font-size: 0.85rem;
    color: var(--color-texto-secundario);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detalle-item .valor {
    font-size: 1.15rem;
    font-weight: 600;
}

/* ─── FILTROS ─── */
.filtros {
    display: flex;
    gap: var(--espacio-sm);
    margin-bottom: var(--espacio-md);
    flex-wrap: wrap;
}

.filtro-btn {
    padding: 10px 20px;
    border: 2px solid var(--color-borde);
    border-radius: 24px;
    background: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    color: var(--color-texto);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.filtro-btn:hover { border-color: var(--color-primario); color: var(--color-primario); }

.filtro-btn.activo {
    background: var(--color-primario);
    color: #fff;
    border-color: var(--color-primario);
}

/* ─── PROGRESO DE CUOTAS ─── */
.progreso-barra {
    width: 100%;
    height: 12px;
    background: #E0E0E0;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 8px;
}

.progreso-relleno {
    height: 100%;
    background: var(--color-exito);
    border-radius: 6px;
    transition: width 0.5s ease;
}
