/*
 * app.css — Sistema de Comedor Industrial v2.0.0
 * Dark theme overrides and custom components for Bootstrap 5.3.2
 */

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
    --ci-bg-base:        #0f172a;
    --ci-bg-card:        #1e293b;
    --ci-bg-card-hover:  #263348;
    --ci-bg-input:       #0f172a;
    --ci-border:         #334155;
    --ci-border-focus:   #3b82f6;
    --ci-text-primary:   #f1f5f9;
    --ci-text-secondary: #94a3b8;
    --ci-text-muted:     #64748b;
    --ci-accent-blue:    #3b82f6;
    --ci-accent-green:   #22c55e;
    --ci-accent-yellow:  #eab308;
    --ci-accent-red:     #ef4444;
    --ci-accent-purple:  #a855f7;
    --ci-shadow:         0 4px 16px rgba(0,0,0,0.4);
    --ci-radius:         0.5rem;
    --ci-transition:     0.2s ease;
}

/* ============================================================
   BASE & BODY
   ============================================================ */
html, body {
    height: 100%;
    background-color: var(--ci-bg-base);
    color: var(--ci-text-primary);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    min-height: 100vh;
}

html { scroll-behavior: smooth; }

/* ============================================================
   SCROLLBAR (Webkit)
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--ci-bg-base); }
::-webkit-scrollbar-thumb { background: var(--ci-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ci-text-muted); }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
    background-color: #0d1526 !important;
    border-bottom: 1px solid var(--ci-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}
.navbar-brand {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.3px;
}
.navbar .navbar-nav {
    align-items: center;
}
.navbar .nav-link {
    color: var(--ci-text-secondary) !important;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 0.45rem 0.875rem;
    border-radius: 0.375rem;
    transition: color var(--ci-transition), background var(--ci-transition);
}
.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: var(--ci-text-primary) !important;
    background-color: rgba(59,130,246,0.15);
}
.navbar .nav-link.active {
    color: var(--ci-accent-blue) !important;
}
/* Ocultar caret automático de Bootstrap en dropdowns del navbar */
.navbar .nav-link.dropdown-toggle::after {
    display: none;
}
/* ── Mobile nav: menú táctil ── */
@media (max-width: 991.98px) {
    #navMain {
        background: #0d1526;
        border-top: 1px solid #334155;
        padding: 0.5rem 0;
        margin-top: 0.5rem;
    }
    #navMain .nav-link {
        font-size: 1rem !important;
        padding: 0.9rem 1.25rem !important;
        border-radius: 0 !important;
        border-bottom: 1px solid #1e293b;
        display: flex;
        align-items: center;
        gap: 0.6rem;
        color: #cbd5e1 !important;
        min-height: 54px;
    }
    #navMain .nav-link:hover,
    #navMain .nav-link.active {
        background: rgba(59,130,246,0.12) !important;
        color: #fff !important;
        padding-left: 1.25rem !important;
    }
    #navMain .dropdown-menu {
        position: static !important;
        background: #111827;
        border: none;
        border-left: 3px solid #3b82f6;
        border-radius: 0;
        padding: 0;
        margin: 0;
        box-shadow: none;
    }
    #navMain .dropdown-item {
        padding: 0.65rem 1.5rem;
        border-bottom: 1px solid #1e293b;
        font-size: 0.9rem;
    }
    #navMain .navbar-nav {
        gap: 0 !important;
        width: 100%;
    }
    #navMain .nav-item {
        width: 100%;
    }
    #navMain .nav-link,
    #navMain .dropdown-toggle {
        width: 100%;
        text-align: left !important;
        justify-content: flex-start !important;
    }
    /* Info de usuario al fondo del menú mobile */
    #navMain .navbar-user-info {
        padding: 0.75rem 1.25rem;
        border-top: 1px solid #334155;
        margin-top: 0.25rem;
    }
}
/* ── Mobile nav: light mode ── */
@media (max-width: 991.98px) {
    [data-bs-theme="light"] #navMain {
        background: #1e40af;
        border-top: 1px solid rgba(255,255,255,0.2);
    }
    [data-bs-theme="light"] #navMain .nav-link {
        color: rgba(255,255,255,0.9) !important;
        border-bottom-color: rgba(255,255,255,0.12);
    }
    [data-bs-theme="light"] #navMain .nav-link:hover,
    [data-bs-theme="light"] #navMain .nav-link.active {
        background: rgba(255,255,255,0.15) !important;
        color: #fff !important;
    }
    [data-bs-theme="light"] #navMain .dropdown-menu {
        background: #1e3a8a;
        border-left-color: rgba(255,255,255,0.4);
    }
    [data-bs-theme="light"] #navMain .dropdown-item {
        color: rgba(255,255,255,0.9) !important;
        border-bottom-color: rgba(255,255,255,0.08);
    }
    [data-bs-theme="light"] #navMain .dropdown-item:hover {
        background: rgba(255,255,255,0.15) !important;
        color: #fff !important;
    }
}

.navbar .dropdown-menu {
    background-color: #1a2744;
    border: 1px solid var(--ci-border);
    box-shadow: var(--ci-shadow);
    min-width: 180px;
}
.navbar .dropdown-item {
    color: var(--ci-text-secondary);
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    transition: background var(--ci-transition);
}
.navbar .dropdown-item:hover {
    background-color: rgba(59,130,246,0.2);
    color: var(--ci-text-primary);
}
.navbar .dropdown-divider { border-color: var(--ci-border); }

/* Notification bell */
.notification-bell {
    position: relative;
    cursor: pointer;
}
.notification-bell .badge {
    position: absolute;
    top: -4px;
    right: -6px;
    font-size: 0.6rem;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    animation: pulse-badge 2s infinite;
}
@keyframes pulse-badge {
    0%  { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
    70% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
    100%{ box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
main.container-fluid {
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background-color: var(--ci-bg-card);
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius);
    box-shadow: var(--ci-shadow);
    transition: border-color var(--ci-transition);
}
.card:hover { border-color: #475569; }
.card-header {
    background-color: rgba(0,0,0,0.2);
    border-bottom: 1px solid var(--ci-border);
    padding: 0.75rem 1rem;
}
.card-footer {
    background-color: rgba(0,0,0,0.15);
    border-top: 1px solid var(--ci-border);
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
    background: var(--ci-bg-card);
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius);
    padding: 1.25rem;
    transition: transform var(--ci-transition), border-color var(--ci-transition), box-shadow var(--ci-transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--ci-accent-blue);
    opacity: 0;
    transition: opacity var(--ci-transition);
}
.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--ci-accent-blue);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.stat-card:hover::before { opacity: 1; }
.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
}
.stat-card .stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ci-text-secondary);
}
.stat-card .stat-icon {
    font-size: 2rem;
    opacity: 0.2;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

/* ============================================================
   DAY CARDS (Election View)
   ============================================================ */
.day-card {
    background: var(--ci-bg-card);
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius);
    transition: border-color var(--ci-transition);
}
.day-card.day-enabled {
    border-color: #334155;
}
.day-card.day-enabled:focus-within {
    border-color: var(--ci-accent-blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.day-card.day-disabled {
    opacity: 0.5;
    pointer-events: none;
}
.day-card .day-header {
    background: rgba(0,0,0,0.2);
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--ci-border);
    border-radius: var(--ci-radius) var(--ci-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.day-card .day-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ci-text-primary);
}
.day-card .day-date {
    font-size: 0.75rem;
    color: var(--ci-text-muted);
}

/* ── Tarjetas de opción de menú (mobile-first) ── */
.opcion-radio label.opcion-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-height: 56px;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 2px solid #334155;
    background: #1e293b;
    color: #94a3b8;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    width: 100%;
    text-align: left;
    font-size: 0.95rem;
    -webkit-tap-highlight-color: transparent;
}
.opcion-radio label.opcion-card .opcion-circulo {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #475569;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s;
}
.opcion-radio label.opcion-card .opcion-circulo::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    transition: background 0.15s;
}
/* Almuerzo seleccionado */
.opcion-radio input[type=radio]:checked + label.opcion-card.opcion-almuerzo {
    border-color: #eab308;
    background: rgba(234,179,8,0.12);
    color: #fde047;
}
.opcion-radio input[type=radio]:checked + label.opcion-card.opcion-almuerzo .opcion-circulo {
    border-color: #eab308;
    background: #eab308;
}
.opcion-radio input[type=radio]:checked + label.opcion-card.opcion-almuerzo .opcion-circulo::after {
    background: #1e293b;
}
/* Colación seleccionada */
.opcion-radio input[type=radio]:checked + label.opcion-card.opcion-colacion {
    border-color: #22c55e;
    background: rgba(34,197,94,0.12);
    color: #86efac;
}
.opcion-radio input[type=radio]:checked + label.opcion-card.opcion-colacion .opcion-circulo {
    border-color: #22c55e;
    background: #22c55e;
}
.opcion-radio input[type=radio]:checked + label.opcion-card.opcion-colacion .opcion-circulo::after {
    background: #1e293b;
}
/* Opción "ninguno" seleccionada */
.opcion-radio input[type=radio]:checked + label.opcion-card.opcion-ninguno {
    border-color: #64748b;
    background: rgba(100,116,139,0.1);
    color: #94a3b8;
}
.opcion-radio input[type=radio]:checked + label.opcion-card.opcion-ninguno .opcion-circulo {
    border-color: #64748b;
    background: #64748b;
}
.opcion-radio input[type=radio]:checked + label.opcion-card.opcion-ninguno .opcion-circulo::after {
    background: #1e293b;
}
.opcion-radio label.opcion-card .opcion-texto strong {
    display: block;
    font-size: 0.95rem;
    line-height: 1.3;
}
.opcion-radio label.opcion-card .opcion-texto small {
    font-size: 0.8rem;
    opacity: 0.75;
}

/* Election period indicator */
.election-period-open {
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.3);
    border-radius: var(--ci-radius);
    padding: 0.5rem 0.85rem;
    color: #86efac;
    font-size: 0.82rem;
}
.election-period-closed {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: var(--ci-radius);
    padding: 0.5rem 0.85rem;
    color: #fca5a5;
    font-size: 0.82rem;
}

/* Delivery point selector */
.delivery-point-selector {
    display: none;
    animation: fadeIn 0.2s ease;
}
.delivery-point-selector.visible { display: block; }

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

/* ============================================================
   TABLES
   ============================================================ */
.table-dark {
    --bs-table-bg: var(--ci-bg-card);
    --bs-table-hover-bg: var(--ci-bg-card-hover);
    --bs-table-border-color: var(--ci-border);
    --bs-table-color: var(--ci-text-primary);
}
.table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ci-text-secondary);
    border-bottom: 1px solid var(--ci-border) !important;
    font-weight: 600;
    padding: 0.6rem 0.75rem;
    white-space: nowrap;
}
.table td {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(51,65,85,0.5);
}
.table tbody tr:last-child td { border-bottom: none; }

/* Delivery rows highlight */
.delivery-row-success {
    animation: highlight-green 1.5s ease;
}
.delivery-row-duplicate {
    animation: highlight-red 1.5s ease;
}
@keyframes highlight-green {
    0%   { background-color: rgba(34,197,94,0.3); }
    100% { background-color: transparent; }
}
@keyframes highlight-red {
    0%   { background-color: rgba(239,68,68,0.3); }
    100% { background-color: transparent; }
}

/* ============================================================
   BADGES (estado)
   ============================================================ */
.badge-estado-publicado {
    background: rgba(34,197,94,0.2);
    color: #86efac;
    border: 1px solid rgba(34,197,94,0.4);
}
.badge-estado-borrador {
    background: rgba(100,116,139,0.2);
    color: #94a3b8;
    border: 1px solid rgba(100,116,139,0.4);
}
.badge-estado-pendiente {
    background: rgba(245,158,11,0.2);
    color: #fcd34d;
    border: 1px solid rgba(245,158,11,0.4);
}
.badge-estado-cerrado {
    background: rgba(239,68,68,0.2);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.4);
}
.badge-estado-completa {
    background: rgba(59,130,246,0.2);
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,0.4);
}
.badge-estado-parcial {
    background: rgba(234,179,8,0.2);
    color: #fde047;
    border: 1px solid rgba(234,179,8,0.4);
}
.badge-estado-sin_carga {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.3);
}

/* Role badges */
.badge-rol-ADMIN    { background: rgba(239,68,68,0.2);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.4); }
.badge-rol-RRHH     { background: rgba(234,179,8,0.2);  color: #fde047; border: 1px solid rgba(234,179,8,0.4); }
.badge-rol-COCINA   { background: rgba(34,197,94,0.2);  color: #86efac; border: 1px solid rgba(34,197,94,0.4); }
.badge-rol-EMPLEADO { background: rgba(59,130,246,0.2); color: #93c5fd; border: 1px solid rgba(59,130,246,0.4); }

/* ============================================================
   FORMS & INPUTS
   ============================================================ */
.form-control,
.form-select {
    background-color: var(--ci-bg-input) !important;
    border-color: var(--ci-border) !important;
    color: var(--ci-text-primary) !important;
    transition: border-color var(--ci-transition), box-shadow var(--ci-transition);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--ci-border-focus) !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2) !important;
    outline: none;
}
.form-control::placeholder { color: var(--ci-text-muted) !important; }
.form-control:disabled,
.form-control[readonly] {
    background-color: #162032 !important;
    opacity: 0.65;
}
.form-label { color: var(--ci-text-secondary); font-size: 0.82rem; font-weight: 500; margin-bottom: 0.35rem; }
.form-text  { color: var(--ci-text-muted) !important; font-size: 0.75rem; }

.form-check-input {
    background-color: var(--ci-bg-input);
    border-color: var(--ci-border);
}
.form-check-input:checked {
    background-color: var(--ci-accent-blue);
    border-color: var(--ci-accent-blue);
}
.form-check-label { color: var(--ci-text-secondary); font-size: 0.85rem; }

.input-group-text {
    background-color: #162032;
    border-color: var(--ci-border);
    color: var(--ci-text-secondary);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn { border-radius: 0.4rem; font-size: 0.85rem; transition: all var(--ci-transition); }
.btn-primary   { background: var(--ci-accent-blue); border-color: var(--ci-accent-blue); }
.btn-primary:hover { background: #2563eb; border-color: #2563eb; transform: translateY(-1px); }
.btn-success:hover { transform: translateY(-1px); }
.btn-danger:hover  { transform: translateY(-1px); }
.btn-sm { font-size: 0.78rem; padding: 0.25rem 0.6rem; }

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
}

/* Button loading state */
.btn.is-loading {
    pointer-events: none;
    opacity: 0.75;
}
.btn.is-loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 6px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   QR SCANNER
   ============================================================ */
.qr-scanner-container {
    position: relative;
    border-radius: var(--ci-radius);
    overflow: hidden;
    background: #000;
    min-height: 280px;
}
#qr-reader {
    width: 100%;
    border-radius: var(--ci-radius);
}
#qr-reader video {
    width: 100% !important;
    border-radius: var(--ci-radius);
}
#qr-reader__dashboard {
    background: var(--ci-bg-card) !important;
    color: var(--ci-text-secondary) !important;
    padding: 0.5rem !important;
    border-top: 1px solid var(--ci-border) !important;
}
#qr-reader__dashboard_section_csr button,
#qr-reader__dashboard_section_fsr button {
    background: var(--ci-accent-blue) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 0.375rem !important;
    padding: 0.35rem 0.75rem !important;
    font-size: 0.82rem !important;
    cursor: pointer !important;
}
#qr-reader__scan_region {
    border: 2px solid var(--ci-accent-blue) !important;
}
.qr-scan-guide {
    text-align: center;
    padding: 2rem;
    color: var(--ci-text-muted);
}
.qr-scan-guide i { font-size: 3rem; display: block; margin-bottom: 0.75rem; }

/* QR delivery result panel */
.delivery-result {
    border-radius: var(--ci-radius);
    padding: 1rem;
    margin-top: 1rem;
    animation: slideIn 0.3s ease;
}
.delivery-result.success {
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.4);
}
.delivery-result.error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.4);
}
.delivery-result.warning {
    background: rgba(234,179,8,0.1);
    border: 1px solid rgba(234,179,8,0.4);
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.employee-delivery-card {
    background: rgba(59,130,246,0.08);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: var(--ci-radius);
    padding: 0.85rem;
}
.employee-delivery-card .emp-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ci-text-primary);
}
.employee-delivery-card .emp-detail {
    font-size: 0.8rem;
    color: var(--ci-text-secondary);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.page-link {
    background-color: var(--ci-bg-card);
    border-color: var(--ci-border);
    color: var(--ci-text-secondary);
    transition: all var(--ci-transition);
}
.page-link:hover {
    background-color: var(--ci-bg-card-hover);
    border-color: var(--ci-accent-blue);
    color: var(--ci-text-primary);
}
.page-item.active .page-link {
    background-color: var(--ci-accent-blue);
    border-color: var(--ci-accent-blue);
    color: #fff;
}
.page-item.disabled .page-link {
    background-color: var(--ci-bg-card);
    border-color: var(--ci-border);
    color: var(--ci-text-muted);
}

/* ============================================================
   ALERTS & FLASH MESSAGES
   ============================================================ */
.alert {
    border-radius: var(--ci-radius);
    font-size: 0.85rem;
    animation: slideInAlert 0.3s ease;
}
@keyframes slideInAlert {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.alert-success {
    background: rgba(34,197,94,0.12);
    border-color: rgba(34,197,94,0.4);
    color: #86efac;
}
.alert-danger {
    background: rgba(239,68,68,0.12);
    border-color: rgba(239,68,68,0.4);
    color: #fca5a5;
}
.alert-warning {
    background: rgba(234,179,8,0.12);
    border-color: rgba(234,179,8,0.4);
    color: #fde047;
}
.alert-info {
    background: rgba(59,130,246,0.12);
    border-color: rgba(59,130,246,0.4);
    color: #93c5fd;
}

/* ============================================================
   TABS
   ============================================================ */
.nav-tabs {
    border-bottom: 1px solid var(--ci-border);
    gap: 0.25rem;
}
.nav-tabs .nav-link {
    color: var(--ci-text-secondary);
    border: 1px solid transparent;
    border-radius: 0.375rem 0.375rem 0 0;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    transition: all var(--ci-transition);
}
.nav-tabs .nav-link:hover {
    color: var(--ci-text-primary);
    border-color: var(--ci-border) var(--ci-border) transparent;
    background: rgba(59,130,246,0.08);
}
.nav-tabs .nav-link.active {
    color: var(--ci-text-primary);
    background: var(--ci-bg-card);
    border-color: var(--ci-accent-blue) var(--ci-accent-blue) var(--ci-bg-card);
}
.tab-content { padding-top: 1rem; }

/* ============================================================
   LIST GROUP
   ============================================================ */
.list-group-item {
    background-color: var(--ci-bg-card);
    border-color: var(--ci-border);
    color: var(--ci-text-primary);
    transition: background var(--ci-transition);
}
.list-group-item-action:hover {
    background-color: var(--ci-bg-card-hover);
    color: var(--ci-text-primary);
}
.list-group-item.active {
    background-color: rgba(59,130,246,0.2);
    border-color: var(--ci-accent-blue);
    color: var(--ci-text-primary);
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-content {
    background-color: var(--ci-bg-card);
    border: 1px solid var(--ci-border);
    box-shadow: var(--ci-shadow);
}
.modal-header {
    border-bottom: 1px solid var(--ci-border);
    background: rgba(0,0,0,0.2);
}
.modal-footer { border-top: 1px solid var(--ci-border); }
.modal-title { color: var(--ci-text-primary); }

/* ============================================================
   DROPDOWN
   ============================================================ */
.dropdown-menu {
    background-color: var(--ci-bg-card);
    border: 1px solid var(--ci-border);
    box-shadow: var(--ci-shadow);
}
.dropdown-item {
    color: var(--ci-text-secondary);
    font-size: 0.85rem;
    transition: background var(--ci-transition);
}
.dropdown-item:hover { background-color: rgba(59,130,246,0.15); color: var(--ci-text-primary); }
.dropdown-divider { border-color: var(--ci-border); }

/* ============================================================
   EMPLOYEE SEARCH AUTOCOMPLETE
   ============================================================ */
.autocomplete-wrapper { position: relative; }
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--ci-bg-card);
    border: 1px solid var(--ci-border);
    border-top: none;
    border-radius: 0 0 var(--ci-radius) var(--ci-radius);
    max-height: 240px;
    overflow-y: auto;
    z-index: 1050;
    box-shadow: var(--ci-shadow);
}
.autocomplete-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--ci-text-secondary);
    border-bottom: 1px solid rgba(51,65,85,0.4);
    transition: background var(--ci-transition);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background: rgba(59,130,246,0.15);
    color: var(--ci-text-primary);
}
.autocomplete-item .emp-name { font-weight: 600; color: var(--ci-text-primary); }
.autocomplete-item .emp-detail { font-size: 0.75rem; color: var(--ci-text-muted); }

/* ============================================================
   MENU FORM (Cocina)
   ============================================================ */
.menu-day-section {
    background: var(--ci-bg-card);
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius);
    transition: border-color var(--ci-transition);
}
.menu-day-section.is-enabled { border-color: #334155; }
.menu-day-section.is-disabled { opacity: 0.5; }
.opcion-row {
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--ci-border);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.4rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.opcion-row .btn-remove-opcion {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.7rem;
}

/* ============================================================
   PREPARACION TABLE
   ============================================================ */
.prep-input {
    width: 80px;
    text-align: center;
    padding: 0.25rem 0.5rem;
    font-variant-numeric: tabular-nums;
}
.prep-row td { vertical-align: middle; }

/* ============================================================
   NOTIFICATION ITEMS
   ============================================================ */
.notif-item {
    background: var(--ci-bg-card);
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius);
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    transition: all var(--ci-transition);
    position: relative;
}
.notif-item.unread {
    border-left: 3px solid var(--ci-accent-blue);
    background: rgba(59,130,246,0.05);
}
.notif-item.read { opacity: 0.7; }
.notif-item .notif-type-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.notif-item .notif-fecha { font-size: 0.75rem; color: var(--ci-text-muted); }
.notif-item .notif-body { font-size: 0.85rem; color: var(--ci-text-secondary); }
.notif-mark-read {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    color: var(--ci-text-muted);
    background: none;
    border: none;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: all var(--ci-transition);
}
.notif-mark-read:hover { color: var(--ci-accent-green); background: rgba(34,197,94,0.1); }

/* ============================================================
   LOADING STATES
   ============================================================ */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}
.loading-overlay .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--ci-border);
    border-top-color: var(--ci-accent-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer.ci-footer {
    background: #0d1526;
    border-top: 1px solid var(--ci-border);
    padding: 0.75rem 1.5rem;
    color: var(--ci-text-muted);
    font-size: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
}
footer.ci-footer a { color: var(--ci-accent-blue); text-decoration: none; }
footer.ci-footer a:hover { text-decoration: underline; }

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 767.98px) {
    main.container-fluid { padding: 1rem 0.75rem; }
    .stat-card .stat-number { font-size: 1.5rem; }
    .stat-card .stat-icon { display: none; }
    .table-responsive { font-size: 0.8rem; }
    .day-card { margin-bottom: 0.75rem; }
    footer.ci-footer { flex-direction: column; gap: 0.25rem; text-align: center; }

    /* Títulos de página con botones — stack vertical */
    .d-flex.justify-content-between.align-items-center.mb-4,
    .d-flex.justify-content-between.align-items-center.mb-3 {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
    /* Grupos de botones — wrap */
    .d-flex.gap-2 { flex-wrap: wrap; }

    /* Tabs de días en elección — scroll horizontal */
    #dias-tabs { overflow-x: auto; flex-wrap: nowrap !important; padding-bottom: 0.5rem; -webkit-overflow-scrolling: touch; }
    #dias-tabs .nav-item { flex-shrink: 0; }

    /* Cards de opciones — full width */
    .opcion-radio { width: 100% !important; }

    /* Tablas — texto más pequeño */
    .table th, .table td { font-size: 0.78rem; padding: 0.4rem 0.5rem; }

    /* Columnas de formulario sin breakpoint mobile — full width */
    [class*="col-md-"]:not([class*="col-"]:not([class*="col-md-"])) { width: 100%; }
}
@media (max-width: 575.98px) {
    .btn-sm { font-size: 0.72rem; padding: 0.2rem 0.45rem; }
    h2 { font-size: 1.1rem; }
    .stat-card-col { width: 50% !important; }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 10pt;
    }
    .navbar, footer, .alert, .btn, .no-print { display: none !important; }
    main.container-fluid { padding: 0 !important; max-width: none !important; }
    .card {
        background: #fff !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
    .card-header { background: #f0f0f0 !important; }
    .table { color: #000 !important; }
    .table th { background: #e0e0e0 !important; color: #000 !important; }
    .badge { border: 1px solid #999 !important; color: #000 !important; background: #eee !important; }
    .stat-card { border: 1px solid #ccc !important; }
    .stat-card .stat-number { color: #000 !important; }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.font-mono { font-family: 'Courier New', Courier, monospace; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.border-start-blue   { border-left: 3px solid var(--ci-accent-blue) !important; }
.border-start-green  { border-left: 3px solid var(--ci-accent-green) !important; }
.border-start-red    { border-left: 3px solid var(--ci-accent-red) !important; }
.border-start-yellow { border-left: 3px solid var(--ci-accent-yellow) !important; }

/* ============================================================
   LIGHT THEME
   ============================================================ */
/* ============================================================
   LIGHT THEME — variables + overrides
   ============================================================ */
[data-bs-theme="light"] {
    --ci-bg-base:        #f1f5f9;
    --ci-bg-card:        #ffffff;
    --ci-bg-card-hover:  #f8fafc;
    --ci-bg-input:       #ffffff;
    --ci-border:         #cbd5e1;
    --ci-border-focus:   #3b82f6;
    --ci-text-primary:   #0f172a;
    --ci-text-secondary: #475569;
    --ci-text-muted:     #94a3b8;
    --ci-shadow:         0 4px 16px rgba(0,0,0,0.08);
}

/* Variables cascade desde html; body hereda */
[data-bs-theme="light"] body {
    background-color: var(--ci-bg-base);
    color: var(--ci-text-primary);
}

/* ── Navbar ── */
[data-bs-theme="light"] .navbar {
    background-color: #1e40af !important;
    border-bottom-color: #1d4ed8;
}
[data-bs-theme="light"] .navbar :is(.nav-link, .navbar-brand) {
    color: rgba(255,255,255,0.9) !important;
}
[data-bs-theme="light"] .navbar .nav-link:is(:hover, .active) {
    color: #ffffff !important;
    background-color: rgba(255,255,255,0.15) !important;
}
[data-bs-theme="light"] .navbar .btn-outline-secondary {
    color: rgba(255,255,255,0.85);
    border-color: rgba(255,255,255,0.4);
}
[data-bs-theme="light"] .navbar .btn-outline-secondary:hover {
    background-color: rgba(255,255,255,0.15);
    color: #fff;
}
[data-bs-theme="light"] .navbar-brand img {
    filter: brightness(1.15) drop-shadow(0 0 4px rgba(255,255,255,0.4));
}

/* ── Dropdowns de la navbar ── */
[data-bs-theme="light"] .navbar :is(.dropdown-menu, .dropdown-menu-dark) {
    background-color: #1e3a8a !important;
    border-color: #1d4ed8 !important;
}
[data-bs-theme="light"] .navbar :is(.dropdown-menu, .dropdown-menu-dark) .dropdown-item {
    color: rgba(255,255,255,0.9) !important;
}
[data-bs-theme="light"] .navbar :is(.dropdown-menu, .dropdown-menu-dark) .dropdown-item:hover {
    background-color: rgba(255,255,255,0.15) !important;
    color: #fff !important;
}
[data-bs-theme="light"] .navbar :is(.dropdown-menu, .dropdown-menu-dark) :is(.dropdown-header, .dropdown-item-text) {
    color: rgba(255,255,255,0.6) !important;
}
[data-bs-theme="light"] .navbar :is(.dropdown-menu, .dropdown-menu-dark) .dropdown-divider {
    border-color: rgba(255,255,255,0.2) !important;
}

/* ── Cards y stat-cards ── */
[data-bs-theme="light"] :is(.card, .stat-card) {
    background-color: var(--ci-bg-card);
    border-color: var(--ci-border);
    color: var(--ci-text-primary);
}
[data-bs-theme="light"] .card-header {
    background-color: #e2e8f0;
    border-bottom-color: var(--ci-border);
    color: var(--ci-text-primary);
}
[data-bs-theme="light"] .card-body {
    background-color: var(--ci-bg-card);
    color: var(--ci-text-primary);
}
[data-bs-theme="light"] .stat-card .stat-icon { opacity: 0.35; }
[data-bs-theme="light"] .stat-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.12); }

/* ── Fix text-white hardcodeado en vistas — regla universal ── */
[data-bs-theme="light"] .text-white {
    color: var(--ci-text-primary) !important;
}
/* Excepciones: badges con fondo coloreado y navbar mantienen blanco */
[data-bs-theme="light"] .badge.text-white,
[data-bs-theme="light"] .navbar .text-white,
[data-bs-theme="light"] .btn.text-white {
    color: #fff !important;
}

/* ── Tabla ── */
[data-bs-theme="light"] .table {
    --bs-table-bg: #ffffff;
    --bs-table-striped-bg: #f8fafc;
    --bs-table-hover-bg: #f1f5f9;
    --bs-table-border-color: var(--ci-border);
    color: var(--ci-text-primary);
}

/* ── Botones ── */
[data-bs-theme="light"] .btn-dark       { background-color: #1e40af; border-color: #1e40af; color: #fff; }
[data-bs-theme="light"] .btn-dark:hover { background-color: #1d4ed8; border-color: #1d4ed8; }

/* ── Formularios ── */
[data-bs-theme="light"] :is(.form-control, .form-select) {
    background-color: #ffffff;
    border-color: var(--ci-border);
    color: var(--ci-text-primary);
}

/* ── List-group (pisa inline styles hardcodeados) ── */
[data-bs-theme="light"] .list-group-item {
    background-color: #ffffff !important;
    border-color: var(--ci-border) !important;
    color: var(--ci-text-primary) !important;
}
[data-bs-theme="light"] .list-group-item-action:is(:hover, :focus) {
    background-color: #f1f5f9 !important;
    color: var(--ci-text-primary) !important;
}

/* ── Badges ── */
[data-bs-theme="light"] .badge.bg-secondary { background-color: #64748b !important; color: #fff !important; }

/* ── Alerts ── */
[data-bs-theme="light"] .alert-success { background-color: #dcfce7; color: #166534; border-color: #bbf7d0; }
[data-bs-theme="light"] .alert-danger  { background-color: #fee2e2; color: #991b1b; border-color: #fecaca; }
[data-bs-theme="light"] .alert-warning { background-color: #fef9c3; color: #854d0e; border-color: #fef08a; }
[data-bs-theme="light"] .alert-info    { background-color: #dbeafe; color: #1e40af; border-color: #bfdbfe; }

/* ── Footer ── */
[data-bs-theme="light"] footer {
    background-color: #e2e8f0 !important;
    color: var(--ci-text-secondary) !important;
    border-top-color: var(--ci-border) !important;
}

/* ── Botón de tema ── */
#theme-toggle { transition: transform 0.2s ease; }
#theme-toggle:hover { transform: rotate(20deg); }

/* ── table-dark override ── */
[data-bs-theme="light"] .table-dark {
    --bs-table-bg: #ffffff;
    --bs-table-striped-bg: #f8fafc;
    --bs-table-hover-bg: #f1f5f9;
    --bs-table-border-color: var(--ci-border);
    color: var(--ci-text-primary);
}
[data-bs-theme="light"] .table-dark :is(th, td) {
    border-color: var(--ci-border) !important;
}
[data-bs-theme="light"] .table-dark :is(th, td):not([class*="text-"]) {
    color: var(--ci-text-primary) !important;
}
[data-bs-theme="light"] .table-dark :is(th, td).text-white,
[data-bs-theme="light"] .table-dark :is(th, td).text-light {
    color: var(--ci-text-primary) !important;
}

/* ── bg-dark elements (form controls, etc.) ── */
[data-bs-theme="light"] .bg-dark {
    background-color: #e2e8f0 !important;
    color: var(--ci-text-primary) !important;
}
[data-bs-theme="light"] :is(.form-control, .form-select).bg-dark {
    background-color: #ffffff !important;
    border-color: var(--ci-border) !important;
    color: var(--ci-text-primary) !important;
}

/* ── tfoot totals row ── */
[data-bs-theme="light"] tfoot,
[data-bs-theme="light"] tfoot tr { background-color: #e2e8f0 !important; }
[data-bs-theme="light"] tfoot .text-white { color: var(--ci-text-primary) !important; }

/* ── Opcion cards (selección de menú) ── */
[data-bs-theme="light"] .opcion-radio label.opcion-card {
    border-color: var(--ci-border);
    background: #ffffff;
    color: var(--ci-text-secondary);
}
[data-bs-theme="light"] .opcion-radio label.opcion-card .opcion-circulo {
    border-color: var(--ci-border);
}
/* Texto oscuro al seleccionar en light mode */
[data-bs-theme="light"] .opcion-radio input[type=radio]:checked + label.opcion-card.opcion-almuerzo {
    color: #78350f;
}
[data-bs-theme="light"] .opcion-radio input[type=radio]:checked + label.opcion-card.opcion-colacion {
    color: #14532d;
}
[data-bs-theme="light"] .opcion-radio input[type=radio]:checked + label.opcion-card.opcion-almuerzo .opcion-circulo::after,
[data-bs-theme="light"] .opcion-radio input[type=radio]:checked + label.opcion-card.opcion-colacion .opcion-circulo::after,
[data-bs-theme="light"] .opcion-radio input[type=radio]:checked + label.opcion-card.opcion-ninguno .opcion-circulo::after {
    background: #ffffff;
}

/* ── Election period indicators ── */
[data-bs-theme="light"] .election-period-open {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}
[data-bs-theme="light"] .election-period-closed {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}
