:root {
    /* Definimos el color una vez y lo aplicamos a las variables de Bootstrap */
    --primary-color: #2563eb; /* Azul Unificado */
    --bs-primary: #2563eb;    /* Override Bootstrap Botones/Pills */
    --bs-link-color: #2563eb; /* Override Enlaces */
    --bs-link-hover-color: #1d4ed8;
    
    --secondary-color: #1d4ed8;
    --sidebar-width: 260px;
}

/* Forzar background de pills activas y botones para asegurar uniformidad */
.nav-pills .nav-link.active, .btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important; /* Forzar texto blanco */
}

/* Asegurar que si tiene la clase text-muted, se quite al estar activo */
.nav-pills .nav-link.active.text-muted {
    color: white !important;
}

/* Estilo específico para los filtros de pedidos */
.order-filters .nav-link {
    color: #64748b;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    margin-right: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
}
.order-filters .nav-link:hover {
    background-color: #e2e8f0;
    color: #1e293b;
}
.order-filters .nav-link.active {
    background-color: var(--primary-color);
    color: white;
}
[data-bs-theme="dark"] .order-filters .nav-link { color: #94a3b8; }
[data-bs-theme="dark"] .order-filters .nav-link:hover { background-color: #334155; color: white; }

/* Estilo para envolver enlaces largos en tablas */
.text-wrap-link {
    word-break: break-all;
    white-space: normal;
    max-width: 200px;
    display: inline-block;
    font-size: 0.75rem;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bs-body-bg);
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
}

/* --- DARK MODE OVERRIDES --- */
[data-bs-theme="dark"] body { background-color: #1e293b; color: #f1f5f9; }
[data-bs-theme="dark"] .sidebar { background-color: #0f172a !important; border-right: 1px solid #334155 !important; }
[data-bs-theme="dark"] .card { background-color: #1e293b; border: 1px solid #334155; }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select, [data-bs-theme="dark"] .input-group-text, [data-bs-theme="dark"] .dropdown-menu { background-color: #334155; border-color: #475569; color: #f8fafc; }
[data-bs-theme="dark"] .dropdown-item { color: #f8fafc; }
[data-bs-theme="dark"] .dropdown-item:hover { background-color: #475569; }
[data-bs-theme="dark"] .form-control::placeholder { color: #94a3b8; }
[data-bs-theme="dark"] .table-hover tbody tr:hover { background-color: #334155; }
[data-bs-theme="dark"] .page-link { background-color: #334155; border-color: #475569; color: #f8fafc; }
[data-bs-theme="dark"] .page-item.disabled .page-link { background-color: #1e293b; border-color: #475569; color: #64748b; }

/* Custom Styles */
.profile-text { color: #6c757d !important; }
[data-bs-theme="dark"] .profile-text { color: #f8fafc !important; }
[data-bs-theme="dark"] .profile-subtext { color: #94a3b8 !important; }

.custom-select-trigger {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
    padding: 0.375rem 0.75rem; font-size: 1rem; font-weight: 400; line-height: 1.5;
    background-color: #fff; border: 1px solid #dee2e6; border-radius: 0.375rem; color: #212529; text-align: left;
}
[data-bs-theme="dark"] .custom-select-trigger { background-color: #334155; border-color: #475569; color: #f8fafc; }

/* HEADER AZUL UNIFICADO (DÍA Y NOCHE IGUALES) */
.table-blue-header th { background-color: var(--primary-color) !important; color: white !important; border-bottom: none; }

/* NEON BALANCE BADGE - MODO DÍA (Verde Oscuro) */
.badge-neon {
    background-color: rgba(21, 128, 61, 0.1) !important;
    color: #15803d !important;
    border: 1px solid rgba(21, 128, 61, 0.4) !important;
    box-shadow: 0 0 5px rgba(21, 128, 61, 0.1);
    font-weight: 700;
    transition: all 0.3s ease;
}

/* NEON BALANCE BADGE - MODO NOCHE (Verde Neón Brillante) */
[data-bs-theme="dark"] .badge-neon {
    background-color: rgba(30, 255, 0, 0.1) !important;
    color: #1eff00 !important;
    border: 1px solid rgba(30, 255, 0, 0.4) !important;
    box-shadow: 0 0 8px rgba(30, 255, 0, 0.2);
}

/* ALERTAS IN-PAGE (No popups) */
.alert-custom-container {
    display: none; /* Hidden by default */
}

/* UNIFIED BLUE ALERT STYLE (Usado para pedidos, tickets, etc.) */
.alert-order-success {
    background-color: #dbeafe; /* Azul muy claro */
    color: #1e3a8a; /* Azul oscuro */
    border-left: 5px solid var(--primary-color);
    font-size: 0.9rem;
}
[data-bs-theme="dark"] .alert-order-success {
    background-color: #1e3a8a;
    color: #dbeafe;
    border-left: 5px solid #60a5fa;
}

/* Error Alert Style */
.alert-order-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 5px solid #dc2626;
}
[data-bs-theme="dark"] .alert-order-error {
    background-color: #7f1d1d;
    color: #fecaca;
    border-left: 5px solid #f87171;
}

/* Search Autocomplete */
.search-results-dropdown {
    position: absolute; top: 100%; left: 0; width: 100%; z-index: 1050;
    background-color: #fff; border: 1px solid #dee2e6; border-radius: 0 0 0.375rem 0.375rem;
    max-height: 250px; overflow-y: auto; box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); display: none;
}
.search-result-item { padding: 0.75rem 1rem; cursor: pointer; border-bottom: 1px solid #f1f5f9; transition: background-color 0.2s; }
.search-result-item:hover { background-color: #f8fafc; }
[data-bs-theme="dark"] .search-results-dropdown { background-color: #334155; border-color: #475569; }
[data-bs-theme="dark"] .search-result-item { border-bottom-color: #475569; color: #f1f5f9; }
[data-bs-theme="dark"] .search-result-item:hover { background-color: #1e293b; }

/* Compact Table (Afecta a todas las tablas por igual) */
.table-compact { font-size: 0.8rem; } 
.table-compact th { padding: 0.6rem 0.5rem; vertical-align: middle; font-weight: 600; text-transform: uppercase; font-size: 0.75rem; white-space: nowrap; }
.table-compact td { padding: 0.5rem 0.5rem; vertical-align: middle; }
.star-icon { color: #475569; cursor: pointer; transition: color 0.2s, transform 0.2s; font-size: 1rem; }
.star-icon:hover { transform: scale(1.2); }
.star-icon.active { color: #ffc107; }
[data-bs-theme="dark"] .star-icon { color: #64748b; }
[data-bs-theme="dark"] .star-icon.active { color: #ffc107; }

.description-box { font-size: 0.9rem; line-height: 1.6; }
.description-box ul li { margin-bottom: 4px; }

/* WhatsApp Button */
.whatsapp-container { position: fixed; bottom: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; align-items: flex-end; }
.whatsapp-close { background: rgba(0,0,0,0.5); color: white; border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 12px; cursor: pointer; margin-bottom: -10px; z-index: 10001; display: flex; align-items: center; justify-content: center; }
.whatsapp-float { width: 60px; height: 60px; background-color: #25d366; color: #FFF; border-radius: 50px; text-align: center; font-size: 30px; box-shadow: 2px 2px 3px #999; display: flex; align-items: center; justify-content: center; text-decoration: none; transition: transform 0.3s; }
.whatsapp-float:hover { transform: scale(1.1); color: #fff; }

/* Layout & Login */
.login-container { min-height: 100vh; width: 100vw; display: flex; background-color: #ffffff; transition: background-color 0.3s; }
.login-left { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 4rem; background-color: #ffffff; border-right: 1px solid #f1f5f9; }
.login-right { width: 500px; display: flex; align-items: center; justify-content: center; background-color: #ffffff; padding: 2rem; }
[data-bs-theme="dark"] .login-container, [data-bs-theme="dark"] .login-left, [data-bs-theme="dark"] .login-right { background-color: #0f172a; border-color: #334155; }
[data-bs-theme="dark"] .login-left h1, [data-bs-theme="dark"] .login-right h2 { color: #f8fafc !important; }
[data-bs-theme="dark"] .login-left p, [data-bs-theme="dark"] .feature-list li, [data-bs-theme="dark"] .login-right p { color: #cbd5e1 !important; }
[data-bs-theme="dark"] .badge.bg-light { background-color: #334155 !important; color: #f8fafc !important; border-color: #475569 !important; }
.feature-list li { margin-bottom: 1.2rem; display: flex; align-items: center; gap: 15px; font-size: 1.1rem; color: #475569; font-weight: 500; }
.login-box { width: 100%; max-width: 400px; }
.login-theme-toggle { position: absolute; top: 20px; right: 20px; z-index: 1050; }

#app-interface { display: none; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); position: fixed; top: 0; left: 0; height: 100vh; z-index: 1050; border-right: 1px solid var(--bs-border-color); background-color: #ffffff; transition: transform 0.3s ease-in-out; padding-top: 1rem; }
.main-content { margin-left: var(--sidebar-width); padding: 20px; transition: margin-left 0.3s ease-in-out; min-height: 100vh; }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.5); z-index: 1040; }
.sidebar-overlay.show { display: block; }
.nav-link { color: var(--bs-secondary-color); padding: 14px 24px; font-weight: 500; border-left: 4px solid transparent; cursor: pointer; transition: all 0.2s; }
.nav-link:hover, .nav-link.active { color: var(--primary-color); background-color: rgba(99, 102, 241, 0.08); border-left-color: var(--primary-color); }
.icon-box { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.table-nowrap th, .table-nowrap td { white-space: nowrap; }
.hover-card { transition: transform 0.2s; cursor: pointer; }
.hover-card:hover { transform: translateY(-5px); }
@media (max-width: 768px) { .sidebar { transform: translateX(-100%); } .sidebar.show { transform: translateX(0); } .main-content { margin-left: 0; padding: 15px; } .login-left { display: none; } .login-right { width: 100%; padding: 1.5rem; } .login-container { background-color: #fff; } [data-bs-theme="dark"] .login-container { background-color: #0f172a; } }
.hidden-section { display: none; } .active-section { display: block; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.api-box-light { background-color: #f8fafc; color: #1e293b; border: 1px solid #e2e8f0; }
[data-bs-theme="dark"] .api-box-light { background-color: #0f172a; color: #f8fafc; border: 1px solid #334155; }

/* Autofill Fix */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, input:-webkit-autofill:active { -webkit-box-shadow: 0 0 0 30px white inset !important; -webkit-text-fill-color: #1e293b !important; transition: background-color 5000s ease-in-out 0s; }
[data-bs-theme="dark"] input:-webkit-autofill, [data-bs-theme="dark"] input:-webkit-autofill:hover, [data-bs-theme="dark"] input:-webkit-autofill:focus, [data-bs-theme="dark"] input:-webkit-autofill:active { -webkit-box-shadow: 0 0 0 30px #1e293b inset !important; -webkit-text-fill-color: #f8fafc !important; }
.login-input-group .input-group-text { background-color: #fff; border: 1px solid #e2e8f0; color: #64748b; }
.login-input-group .form-control { background-color: #fff; border: 1px solid #e2e8f0; color: #1e293b; padding: 0.75rem 1rem; }
[data-bs-theme="dark"] .login-input-group .input-group-text { background-color: #1e293b; border-color: #334155; color: #94a3b8; }
[data-bs-theme="dark"] .login-input-group .form-control { background-color: #1e293b; border-color: #334155; color: #f8fafc; }
.login-input-group .form-control:focus { background-color: #fff; border-color: var(--primary-color); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1); }
[data-bs-theme="dark"] .login-input-group .form-control:focus { background-color: #1e293b; }