/* css/style.css - Finlex One Reclutamiento */
:root {
    /* COLORES CORPORATIVOS FINLEX ONE */
    --primary: #0d2c4e;       /* Azul Oscuro (Corporativo) */
    --accent: #00a7e0;        /* Azul Vibrante (Acción/Hover) */
    --accent-hover: #008fbf;  /* Azul Vibrante Oscuro */
    --text-dark: #333333;
    --text-light: #6c757d;
    --bg-light: #f4f7f6;
    --white: #ffffff;
    --success: #25D366;       /* WhatsApp Green para cosas positivas */
}

body { 
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
    background-color: var(--bg-light); 
    margin: 0; 
    padding: 0; 
    color: var(--text-dark); 
    line-height: 1.6; 
}

a { text-decoration: none; color: var(--accent); transition: 0.3s; }
a:hover { color: var(--accent-hover); }

/* --- HERO SECTION (NUEVO) --- */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #1a4a7c 100%);
    color: var(--white);
    padding: 80px 20px;
    text-align: center;
}
.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    font-weight: 800;
}
.hero p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto 30px auto;
    opacity: 0.9;
    color: #e0e0e0;
}

/* --- INFO SECTION (PUBLICIDAD) --- */
.info-section {
    background: var(--white);
    padding: 60px 20px;
    text-align: center;
}
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1100px;
    margin: 40px auto 0;
}
.info-card {
    padding: 20px;
}
.info-card i {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 20px;
}
.info-card h3 {
    color: var(--primary);
    margin-bottom: 10px;
}

/* --- VACANTES CONTAINER --- */
.container { max-width: 1100px; margin: 40px auto; padding: 0 20px; min-height: 50vh; }

.section-title {
    text-align: center;
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 40px;
    position: relative;
}
.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--accent);
    margin: 10px auto 0;
    border-radius: 2px;
}

/* CARDS VACANTES (Mejoradas) */
.vacantes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 25px; }
.card { 
    background: var(--white); 
    border-radius: 12px; 
    padding: 30px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); 
    transition: transform 0.3s, box-shadow 0.3s; 
    border: 1px solid #eee; 
    border-top: 4px solid var(--primary); /* Detalle de color */
    display: flex; flex-direction: column; justify-content: space-between; 
}
.card:hover { transform: translateY(-5px); box-shadow: 0 15px 30px rgba(0,0,0,0.1); border-top-color: var(--accent); }
.card h3 { margin: 0 0 5px 0; color: var(--primary); font-size: 1.4rem; }
.card .empresa { color: var(--accent); font-weight: 600; font-size: 0.95rem; margin-bottom: 15px; display: block;}

.tags { margin: 15px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: #eef2f5; color: #555; padding: 5px 12px; border-radius: 4px; font-size: 0.85rem; font-weight: 600; }
.tag i { margin-right: 5px; color: var(--primary); }

.btn-block { width: 100%; padding: 12px; background: var(--primary); color: var(--white); border: none; border-radius: 6px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: 0.3s; text-align: center; display: block; box-sizing: border-box;}
.btn-block:hover { background: #1a4a7c; }

/* FORMS (Login/Registro) */
.auth-box { max-width: 450px; margin: 60px auto; background: var(--white); padding: 40px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.08); border-top: 4px solid var(--accent); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--primary); }
.form-control { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 1rem; }
.form-control:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(0,167,224,0.1); }

/* FOOTER */
footer { background: var(--primary); color: #adb5bd; text-align: center; padding: 30px 0; font-size: 0.9rem; margin-top: 60px; }
footer a { color: var(--white); text-decoration: underline; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
}

/* ==========================================================================
   GLOBAL NAVBAR & ALERTS (Optimizado para iOS, Android y Desktop)
   ========================================================================== */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px); /* Efecto cristal moderno (iOS) */
    -webkit-backdrop-filter: blur(10px);
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 9000; /* Prioridad global sobre otros elementos */
    border-bottom: 1px solid #e2e8f0;
    transition: height 0.3s ease;
}

.brand img {
    height: 42px;
    width: auto;
    object-fit: contain;
    transition: height 0.3s ease;
}

/* Contenedores de enlaces (Soportamos ambas clases que usas actualmente) */
.nav-links, #nav-auth-section {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Enlaces y botones base con Touch Target optimizado (Mínimo 44x44px) */
.nav-link, .nav-icon-btn {
    color: #64748b; 
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease, background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    min-height: 44px; 
    min-width: 44px;
    padding: 5px 12px;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    border: none;
}

.nav-link:hover, .nav-link.active, .nav-icon-btn:hover {
    color: #00a7e0; 
    background: #f1f5f9; /* Feedback táctil/visual */
}

/* Botones destacados (Ej: Mi Perfil, Iniciar Sesión) */
.btn-nav-primary {
    background: #00a7e0;
    color: #ffffff !important;
    border: 1px solid #00a7e0;
    border-radius: 50px;
    padding: 8px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 6px rgba(0, 167, 224, 0.2);
    transition: transform 0.2s, background 0.2s;
}
.btn-nav-primary:hover {
    background: #0d2c4e; 
    border-color: #0d2c4e;
    transform: translateY(-1px);
}

/* --- ANIMACIONES Y ALERTAS (Heredado de chat.html) --- */
.nav-icon-btn.has-messages {
    color: #ef4444 !important;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); color: #ff0000; }
    100% { transform: scale(1); }
}

.badge-notification {
    background: #ef4444;
    box-shadow: 0 0 5px rgba(239, 68, 68, 0.5);
    position: absolute;
    top: 2px;
    right: 2px;
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Separador visual de secciones */
.nav-divider {
    height: 24px;
    width: 1px;
    background-color: #e2e8f0;
    margin: 0 5px;
}

/* ==========================================================================
   AJUSTE RESPONSIVO PARA LAPTOPS Y TABLETS (Evitar quiebre por el nuevo botón)
   ========================================================================== */
@media (max-width: 1050px) {
    .nav-links { gap: 4px; }
    .nav-link { padding: 5px 8px; font-size: 0.85rem; }
    .user-greeting-text { display: none !important; } /* Ocultamos el "Hola" antes de tiempo para dar espacio */
}

/* ==========================================================================
   RESPONSIVE DESIGN (Móviles y Tablets) - SOLUCIÓN DE OVERFLOW
   ========================================================================== */

/* Contenedor de Trámites */
.grid-tramites { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 25px; 
}

@media (max-width: 850px) {
    .navbar {
        padding: 0 10px;
        padding-top: env(safe-area-inset-top); 
    }
    
    .brand img {
        max-width: 90px; /* Hacemos el logo un poco más pequeño */
    }

    .nav-links, #nav-auth-section {
        display: flex;
        gap: 2px; 
        flex: 1;
        justify-content: flex-end;
        
        /* MAGIA MÓVIL: Permite deslizar los iconos horizontalmente con el dedo */
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch; /* Efecto rebote en iOS */
        scrollbar-width: none; /* Oculta la barra de scroll en Firefox */
    }

    /* Oculta la barra de scroll en Chrome/Safari/Edge */
    .nav-links::-webkit-scrollbar, #nav-auth-section::-webkit-scrollbar {
        display: none;
    }

    /* Ocultamos el texto, dejamos solo el icono */
    .nav-link span, .user-greeting-text {
        display: none !important;
    }

    .nav-link, .nav-icon-btn {
        min-width: 40px; /* Garantiza que el área del dedo sea buena */
        flex-shrink: 0; /* EVITA QUE EL NAVEGADOR APLASTE EL ICONO */
        padding: 5px;
    }

    .nav-link i, .nav-icon-btn i {
        font-size: 1.15rem; /* Iconos ligeramente balanceados */
    }

    .btn-nav-primary {
        padding: 8px 14px;
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    /* --- Ajustes para portal del empleado (Mis Contratos) --- */
    .grid-tramites { 
        grid-template-columns: 1fr !important; 
        gap: 15px; 
    }
    
    .grid-3 { 
        grid-template-columns: 1fr 1fr !important; /* Dos columnas para las tarjetas neutral/danger */
        gap: 10px; 
    }
    
    /* La tercera tarjeta (Saldo a Favor) ocupará todo el ancho abajo */
    .grid-3 .k-card:nth-child(3) {
        grid-column: 1 / -1; 
        padding: 25px 15px; 
    }

    /* NUEVO: Fuerza una sola columna para los contratos y evita el desbordamiento */
    .contracts-grid, 
    .p2p-grid { 
        grid-template-columns: 1fr !important; 
    }
    
    /* Ajuste de texto para que quepan bien las dos primeras tarjetas en pantallas pequeñas */
    .grid-3 .k-card h6 { font-size: 0.65rem; }
    .grid-3 .k-card h3 { font-size: 1.8rem; }
    
    .nom-summary { 
        grid-template-columns: 1fr !important; 
        gap: 15px; 
    }
    
    .tabs-header { 
        flex-wrap: nowrap; 
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch; 
        padding-bottom: 5px; 
    }
    
    .page-header { 
        flex-direction: column; 
        text-align: center; 
        padding: 20px; 
    }
    
    .nom-total-row { 
        flex-direction: column; 
        gap: 10px; 
        text-align: center; 
    }

    /* --- NUEVAS CLASES PARA NÓMINA RESPONSIVA --- */
    .nom-asistencia {
        background: var(--bg-body); 
        padding: 12px 15px; 
        border-radius: 6px; 
        font-size: 0.85rem; 
        color: var(--text-main); 
        display: flex; 
        flex-wrap: wrap; /* <-- LA MAGIA: Permite que los elementos bajen de línea */
        gap: 15px; 
        border: 1px solid var(--border-color);
        margin-bottom: 15px;
    }
    .nom-header-title {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
    }

    /* AJUSTES RESPONSIVOS DE NÓMINA AÑADIDOS */
    .nom-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .nom-header-title span {
        margin-left: 0 !important;
        display: block;
        margin-top: 4px;
    }
    .nom-asistencia {
        gap: 10px;
        justify-content: space-between;
    }
    .nom-asistencia > span:first-child {
        flex: 1 1 100%; /* El título "Asistencia" ocupa toda la fila */
        border-bottom: 1px solid #e2e8f0;
        padding-bottom: 5px;
        margin-bottom: 5px;
    }
    .nom-asistencia > span:not(:first-child) {
        flex: 1 1 45%; /* Los contadores se acomodan en 2 columnas perfectas */
    }
}

@media (max-width: 480px) {
    .navbar { height: 60px; }
    
    /* En teléfonos MUY pequeños (ej. iPhone SE), ocultamos el logo 
       para que la barra de navegación ocupe el 100% del ancho como una App Nativa */
    .brand {
        display: none; 
    }
    
    .nav-links {
        width: 100%;
        justify-content: space-between; /* Reparte los iconos uniformemente */
        margin-left: 0;
    }
    
    /* Ajuste del globo de notificación para que no se salga */
    .badge-notification {
        top: 0px;
        right: 0px;
        min-width: 16px;
        height: 16px;
        font-size: 0.6rem;
    }

    /* NUEVO: Apila todas las tarjetas del Kardex de Vacaciones en 1 sola columna */
    .grid-3 { 
        grid-template-columns: 1fr !important; 
        gap: 15px;
    }

    /* NUEVO: Resetea el ancho de la tarjeta verde para que siga el flujo natural */
    .grid-3 .k-card:nth-child(3) {
        grid-column: auto; 
        padding: 20px;
    }
}

/* ==========================================================================
   SISTEMA GLOBAL DE NOTIFICACIONES (TOASTS) Y MODALES DE CONFIRMACIÓN
   ========================================================================== */

/* Contenedor de Toasts Flotantes */
#global-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* Para no bloquear clics debajo */
}

/* Diseño de la Tarjeta Toast */
.finlex-toast {
    background: #ffffff;
    border-left: 4px solid var(--primary);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 250px;
    max-width: 350px;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: auto;
}

.finlex-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.finlex-toast.success { border-left-color: var(--success); }
.finlex-toast.error { border-left-color: #ef4444; }
.finlex-toast.warning { border-left-color: var(--warning); }

.finlex-toast i { font-size: 1.5rem; }
.finlex-toast.success i { color: var(--success); }
.finlex-toast.error i { color: #ef4444; }
.finlex-toast.warning i { color: var(--warning); }

.finlex-toast-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.4;
}

/* Modal de Confirmación Dinámico (Reemplaza al confirm()) */
.finlex-confirm-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(3px);
    z-index: 100001; display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: 0.2s ease;
}

.finlex-confirm-overlay.active { opacity: 1; visibility: visible; }

.finlex-confirm-box {
    background: white; border-radius: 12px; width: 90%; max-width: 400px;
    padding: 25px; text-align: center; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
    transform: translateY(20px) scale(0.95); transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.finlex-confirm-overlay.active .finlex-confirm-box { transform: translateY(0) scale(1); }

.finlex-confirm-icon { font-size: 3rem; color: var(--warning); margin-bottom: 15px; }
.finlex-confirm-title { font-size: 1.25rem; font-weight: 800; color: var(--text-dark); margin-bottom: 10px; }
.finlex-confirm-message { font-size: 0.95rem; color: var(--text-gray); margin-bottom: 25px; line-height: 1.5; }
.finlex-confirm-actions { display: flex; gap: 10px; justify-content: center; }

.finlex-btn-cancel, .finlex-btn-confirm {
    padding: 10px 20px; border-radius: 8px; font-weight: 600; font-size: 0.95rem;
    cursor: pointer; border: none; transition: 0.2s; flex: 1;
}
.finlex-btn-cancel { background: #f1f5f9; color: var(--text-dark); }
.finlex-btn-cancel:hover { background: #e2e8f0; }
.finlex-btn-confirm { background: var(--primary); color: white; }
.finlex-btn-confirm:hover { background: #1e3a8a; }
.finlex-btn-confirm.danger { background: #ef4444; }
.finlex-btn-confirm.danger:hover { background: #dc2626; }