/* ==========================================================================
   GEOMINER FSS - ESTILOS ELEGANTES (FONDO BLANCO, MENÚ NEGRO, LETRAS AMARILLAS)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --bg-main: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F1F5F9;
    --border-color: #E2E8F0;
    --border-subtle: #CBD5E1;
    
    /* Menús y Elementos Oscuros */
    --nav-bg: #0B0F19;
    --nav-card: #131B2E;
    --nav-border: #1E293B;
    
    /* Acentos y Tipografía Amarilla Minera */
    --yellow-primary: #F59E0B;
    --yellow-bright: #FBBF24;
    --yellow-light: #FEF08A;
    --yellow-dark: #D97706;
    --yellow-glow: rgba(245, 158, 11, 0.35);
    
    /* Textos */
    --text-dark: #0F172A;
    --text-muted: #64748B;
    --text-light: #F8FAFC;
    
    /* Semáforo y Alertas */
    --color-green: #10B981;
    --color-yellow: #F59E0B;
    --color-red: #EF4444;
    --color-blue: #0284C7;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    
    --shadow-subtle: 0 2px 10px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.06), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 12px 28px -4px rgba(0, 0, 0, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.5;
    overflow-x: hidden;
}

/* ==========================================================================
   ENCABEZADO Y NAVEGACIÓN SUPERIOR (MENÚ ULTRA-SLIM NEGRO CON LETRAS AMARILLAS)
   ========================================================================== */
.navbar-main {
    background-color: var(--nav-bg);
    color: var(--text-light);
    border-bottom: 2px solid var(--yellow-primary);
    padding: 0 1.25rem;
    height: 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    flex-wrap: nowrap;
    gap: 0.5rem;
}

/* Alias para ambas páginas — misma barra, mismo diseño */
.header-slim {
    background-color: var(--nav-bg);
    color: var(--text-light);
    border-bottom: 2px solid var(--yellow-primary);
    padding: 0 1.25rem;
    height: 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    flex-wrap: nowrap;
    gap: 0.75rem;
    white-space: nowrap;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.brand-text {
    font-size: 1rem;
    font-weight: 900;
    color: var(--yellow-bright);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.brand-text-pro {
    color: #FFFFFF;
}

.brand-tagline {
    font-size: 0.72rem;
    color: #64748B;
    white-space: nowrap;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.brand-logo-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--yellow-bright), var(--yellow-dark));
    color: #000;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 900;
    box-shadow: 0 0 8px var(--yellow-glow);
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--yellow-bright);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.brand-subtitle {
    display: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    list-style: none;
}

.nav-item-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #CBD5E1;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    white-space: nowrap;
}

.nav-item-btn:hover {
    color: var(--yellow-bright);
    background-color: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
}

.nav-item-btn.active {
    background: linear-gradient(135deg, var(--yellow-bright), var(--yellow-dark));
    color: #000;
    font-weight: 700;
    box-shadow: 0 0 8px var(--yellow-glow);
}

.user-status-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--nav-card);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--nav-border);
    white-space: nowrap;
}

.user-status-pill .user-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--yellow-bright);
}

.live-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #10B981;
    border-radius: 50%;
    box-shadow: 0 0 6px #10B981;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* ==========================================================================
   BARRA DE ESTADO DE TURNO Y ALERTA IA (SLIM CONTROL BAR)
   ========================================================================== */
.shift-status-bar {
    background-color: #111827;
    color: #E2E8F0;
    padding: 0.25rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.76rem;
    border-bottom: 1px solid #1F2937;
    height: 28px;
}

.shift-status-bar .highlight-yellow {
    color: var(--yellow-bright);
    font-weight: 700;
}

.btn-yellow {
    background: linear-gradient(135deg, var(--yellow-bright), var(--yellow-dark));
    color: #000;
    font-weight: 700;
    border: none;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 2px 6px var(--yellow-glow);
    text-decoration: none;
    white-space: nowrap;
}

.btn-yellow:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px var(--yellow-glow);
}

.btn-outline-dark {
    background: transparent;
    color: var(--text-dark);
    border: 1px solid var(--border-subtle);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline-dark:hover {
    background: #F1F5F9;
    border-color: var(--text-dark);
}

/* ==========================================================================
   CONTENEDOR PRINCIPAL Y VISTAS (FONDO BLANCO)
   ========================================================================== */
.main-container {
    max-width: 1600px;
    margin: 0.75rem auto;
    padding: 0 1rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 0.75rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.5px;
}

.page-title span.accent {
    color: var(--yellow-dark);
}

.page-description {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

/* ==========================================================================
   KPI CARDS (MÉTRICAS CLAVE EN FONDO BLANCO CON ACENTOS AMARILLOS/NEGROS)
   ========================================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--yellow-primary);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--yellow-primary);
}

.kpi-card.green::before { background: var(--color-green); }
.kpi-card.yellow::before { background: var(--yellow-primary); }
.kpi-card.red::before { background: var(--color-red); }
.kpi-card.dark::before { background: var(--nav-bg); }

.kpi-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.kpi-value-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-top: 0.25rem;
}

.kpi-value {
    font-size: 1.65rem;
    font-weight: 900;
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
}

.kpi-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
}

.badge-green { background: #ECFDF5; color: #059669; border: 1px solid #A7F3D0; }
.badge-yellow { background: #FFFBEB; color: #D97706; border: 1px solid #FDE68A; }
.badge-red { background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; }
.badge-dark { background: #111827; color: var(--yellow-bright); border: 1px solid #374151; }

/* ==========================================================================
   SECCIÓN DE MAPA GPS Y REPRODUCTOR DE RUTA
   ========================================================================== */
.map-section-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.map-header-bar {
    background: var(--nav-bg);
    color: #FFF;
    padding: 0.65rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--yellow-primary);
}

.map-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--yellow-bright);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.map-controls-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.map-container {
    height: 480px;
    width: 100%;
    z-index: 10;
}

.route-player-bar {
    background: #0F172A;
    color: #FFF;
    padding: 0.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-top: 1px solid #1E293B;
}

.player-slider {
    flex: 1;
    accent-color: var(--yellow-bright);
    cursor: pointer;
}

/* ==========================================================================
   PANEL LATERAL DERECHO DE IA (SLIDE-OVER DRAWER)
   ========================================================================== */
.side-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 25, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.side-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.side-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 480px;
    max-width: 90vw;
    height: 100vh;
    background: #0B0F19;
    color: #FFF;
    border-left: 2px solid var(--yellow-primary);
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.6);
    z-index: 2600;
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.side-drawer.active {
    right: 0;
}

.drawer-header {
    padding: 1.25rem 1.5rem;
    background: #111827;
    border-bottom: 1px solid #1F2937;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.drawer-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--yellow-bright);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.drawer-close-btn {
    background: none;
    border: none;
    color: #94A3B8;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}

.drawer-close-btn:hover {
    color: #FFF;
}

.drawer-content {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.drawer-section-card {
    background: #131B2E;
    border: 1px solid #1E293B;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
}

.drawer-section-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--yellow-bright);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ai-flaw-item {
    background: rgba(15, 23, 42, 0.9);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    border-left: 3px solid var(--yellow-primary);
    margin-bottom: 0.65rem;
}

.ai-flaw-item.critica { border-left-color: var(--color-red); }
.ai-flaw-item.alta { border-left-color: var(--yellow-primary); }

.ai-flaw-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--yellow-bright);
    margin-bottom: 0.25rem;
}

.ai-flaw-desc {
    font-size: 0.8rem;
    color: #CBD5E1;
    line-height: 1.35;
}

.ai-flaw-action {
    margin-top: 0.45rem;
    font-size: 0.76rem;
    color: #FEF08A;
    background: rgba(245, 158, 11, 0.12);
    padding: 0.3rem 0.55rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.ai-risk-operator-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #1E293B;
    font-size: 0.82rem;
}

.ai-risk-operator-row:last-child {
    border-bottom: none;
}

/* ==========================================================================
   TABLAS DE OPERADORES Y ALERTAS (FONDO BLANCO Y ENCABEZADOS OSCUROS)
   ========================================================================== */
.card-table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 1.75rem;
}

.table-header {
    background: #FFFFFF;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.table-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-dark);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table thead {
    background: #0B0F19;
    color: var(--yellow-bright);
}

.custom-table th {
    padding: 0.85rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.custom-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.92rem;
    color: var(--text-dark);
}

.custom-table tbody tr {
    transition: background 0.15s ease;
}

.custom-table tbody tr:hover {
    background: #F8FAFC;
}

.operator-cell {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.operator-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.operator-name {
    font-weight: 700;
    color: var(--text-dark);
}

.operator-rut {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   MODALES (FICHA DEL TRABAJADOR Y LOGIN MAESTRO)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    padding: 1rem;
}

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

.modal-card {
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
}

.modal-header-dark {
    background: #0B0F19;
    color: #FFF;
    padding: 0.85rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--yellow-primary);
    flex-shrink: 0;
}

.modal-header-title {
    color: var(--yellow-bright);
    font-size: 1.1rem;
    font-weight: 800;
}

.modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.worker-profile-hero {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    background: #F8FAFC;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.worker-hero-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--yellow-primary);
}

.info-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-field {
    background: #F8FAFC;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.info-field-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
}

.info-field-val {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 0.2rem;
}

/* ==========================================================================
   TEST PVT (APP MÓVIL / KIOSCO)
   ========================================================================== */
.pvt-test-arena {
    background: #0B0F19;
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    text-align: center;
    color: #FFF;
    border: 2px solid var(--yellow-primary);
    cursor: pointer;
    user-select: none;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.pvt-test-arena.waiting {
    background: #1E293B;
}

.pvt-test-arena.stimulus {
    background: #DC2626;
    animation: flash 0.2s;
}

.pvt-reaction-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 4rem;
    font-weight: 900;
    color: var(--yellow-bright);
}

/* ==========================================================================
   RESPONSIVIDAD
   ========================================================================== */
@media (max-width: 900px) {
    .navbar-main {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    .shift-status-bar {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    .info-grid-2col {
        grid-template-columns: 1fr;
    }
}
