/* sidebar.css - Sidebar colapsable moderno & Design System Refinado */

/* ============================================
   VARIABLES Y SISTEMA DE DISEÑO
   ============================================ */

:root {
    /* --- Tipografía --- */
    --font-family-base: 'Inter', system-ui, -apple-system, sans-serif;

    /* --- Light Mode (Default) --- */
    /* Backgrounds */
    --bg-body: #f3f4f6;
    /* Gris muy suave, menos clínico que el blanco */
    --bg-surface: #ffffff;
    --bg-hover: #f9fafb;

    /* Text */
    --text-primary: #111827;
    /* Gris muy oscuro, casi negro */
    --text-secondary: #4b5563;
    --text-tertiary: #9ca3af;

    /* Borders */
    --border-color: #e5e7eb;

    /* Brand & Accents (Corporate Orange #F39200) */
    --primary-color: #F39200;
    --primary-hover: #d67e00;
    --primary-light: rgba(243, 146, 0, 0.1);

    /* Status Colors (Menos saturados) */
    --danger-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;

    /* Sidebar Specific */
    --sidebar-width: 260px;
    /* Un poco más ancho para elegancia */
    --sidebar-collapsed-width: 72px;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e5e7eb;
    --sidebar-text: #4b5563;
    --sidebar-text-hover: #111827;
    --sidebar-active-bg: rgba(243, 146, 0, 0.1);
    /* Fondo sutil para activo */
    --sidebar-active-text: #F39200;
    /* Texto color primario */
    --sidebar-hover-bg: #f9fafb;
    --sidebar-section-text: #9ca3af;

    /* UI Elements */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Dark Mode Variables (Refinado) --- */
[data-theme="dark"] {
    /* Backgrounds - Escala Slate (Azulada) */
    --bg-body: #0f172a;
    /* Slate 900 */
    --bg-surface: #1e293b;
    /* Slate 800 */
    --bg-hover: #334155;
    /* Slate 700 */

    /* Text */
    --text-primary: #f8fafc;
    /* Slate 50 */
    --text-secondary: #cbd5e1;
    /* Slate 300 */
    --text-tertiary: #94a3b8;
    /* Slate 400 */

    /* Borders */
    --border-color: #334155;
    /* Slate 700 */

    /* Brand & Accents */
    --primary-color: #F39200;
    --primary-hover: #ffa31a;
    --primary-light: rgba(243, 146, 0, 0.15);

    /* Sidebar Specific */
    --sidebar-bg: #1e293b;
    --sidebar-border: #334155;
    --sidebar-text: #cbd5e1;
    --sidebar-text-hover: #f8fafc;
    --sidebar-active-bg: rgba(243, 146, 0, 0.15);
    --sidebar-active-text: #ffa31a;
    --sidebar-hover-bg: #334155;
    --sidebar-section-text: #64748b;

    /* Shadows (más sutiles en dark) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

    /* Dashboard & Cards */
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    /* Fix previo */
}

/* ============================================
   GLOBAL RESET & TYPOGRAPHY
   ============================================ */

html {
    overflow-y: scroll;
    overflow-x: hidden;
    /* Siempre mostrar scrollbar vertical y ocultar horizontal para evitar salto de layout */
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family-base);
    background-color: var(--bg-body);
    color: var(--text-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
    -webkit-font-smoothing: antialiased;
    /* Texto más nítido */
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.025em;
    /* Tight spacing para títulos modernos */
}

/* ============================================
   BOOTSTRAP OVERRIDES (Corporate Branding)
   ============================================ */
.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.badge.bg-primary {
    background-color: var(--primary-color) !important;
}

.btn-outline-primary {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}

/* Fix para focus rings y outlines */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(243, 146, 0, 0.25);
}


/* Layout principal con sidebar */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow: hidden;
    transition: width var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal);
    z-index: 1000;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* ============================================
   HEADER DEL SIDEBAR (Logo)
   ============================================ */

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Centrado cuando está colapsado */
    padding: 21px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    min-height: 81px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--sidebar-text-hover);
    font-weight: 700;
    font-size: 19px;
    white-space: nowrap;
    overflow: hidden;
    width: 100%;
    letter-spacing: -0.01em;
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #F39200 0%, #d67e00 100%);
    border-radius: 10px;
    /* Bordes más redondeados */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.sidebar-brand-text {
    transition: opacity var(--transition-normal);
}

.sidebar.collapsed .sidebar-brand-text {
    opacity: 0;
    width: 0;
    display: none;
}

/* ============================================
   NAVEGACIÓN
   ============================================ */

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--sidebar-border);
    border-radius: 4px;
}

/* Sección de navegación */
.nav-section {
    margin-bottom: 28px;
}

.nav-section-title {
    padding: 8px 24px;
    font-size: 11px;
    font-weight: 700;
    color: var(--sidebar-section-text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    /* Más espaciado para caps */
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-normal);
}

.sidebar.collapsed .nav-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
}

.nav-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Items de navegación */
.nav-item {
    margin: 2px 16px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    font-weight: 500;
    font-size: 14px;
}

.nav-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-hover);
    transform: translateX(4px);
    /* Micro-interacción: mover a la derecha */
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

.nav-link.active::before {
    /* Indicador vertical activo */
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 4px;
    background-color: var(--primary-color);
    border-radius: 0 4px 4px 0;
    display: none;
    /* Opcional: mostrar indicator */
}

.nav-link-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.nav-link-text {
    transition: opacity var(--transition-normal);
}

.sidebar.collapsed .nav-link-text {
    opacity: 0;
    width: 0;
}

/* ============================================
   SUBMENÚS EXPANDIBLES
   ============================================ */

/* Contenedor del item con submenú */
.nav-item.has-submenu {
    position: relative;
}

.nav-link-group {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
}

.nav-link-group .nav-link {
    flex: 1;
    margin: 0;
}

.submenu-toggle-btn {
    width: 40px;
    height: 100%;
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-radius: var(--radius-md);
    z-index: 2;
}

.submenu-toggle-btn:hover {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

.sidebar.collapsed .submenu-toggle-btn {
    display: none;
}

/* Flecha del submenú */
.submenu-arrow {
    font-size: 12px;
    transition: transform var(--transition-fast);
    pointer-events: none; /* Dejar que el botón maneje el click */
}

/* Submenú oculto por defecto */
.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 0;
    background: var(--sidebar-hover-bg);
    border-radius: var(--radius-md);
    margin-top: 4px;
}

/* Submenú abierto */
.nav-item.has-submenu.open .submenu {
    max-height: 200px;
    opacity: 1;
}

/* Items dentro del submenú */
.submenu .nav-item {
    margin: 0;
}

.submenu .nav-link {
    padding: 9px 16px 9px 44px;
    font-size: 13px;
}

.submenu .nav-link-icon {
    font-size: 14px;
    width: 16px;
    height: 16px;
}

/* Hover en items del submenú */
.submenu .nav-link:hover {
    background: var(--sidebar-active-bg);
    transform: translateX(2px);
}

/* Item activo en submenú */
.submenu .nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

/* Sidebar colapsado: ocultar submenú y mostrar como tooltip */
.sidebar.collapsed .submenu {
    display: none;
}

.sidebar.collapsed .nav-item.has-submenu .submenu-toggle {
    justify-content: center;
}

/* Badge de notificaciones */
.nav-badge {
    margin-left: auto;
    background: var(--danger-color);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    min-width: 22px;
    text-align: center;
    flex-shrink: 0;
    transition: opacity var(--transition-normal);
}

.sidebar.collapsed .nav-badge {
    opacity: 0;
    width: 0;
    padding: 0;
}

/* Badge absoluto cuando sidebar está colapsado */
.sidebar.collapsed .nav-link:has(.nav-badge) .nav-link-icon::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger-color);
    border-radius: 50%;
    border: 2px solid var(--sidebar-bg);
}

/* Centrado de iconos al colapsar */
.sidebar.collapsed .nav-item {
    margin: 4px 0;
    /* Vertical margin only, horizontal handled by flex align or auto margins */
    display: flex;
    justify-content: center;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0;
    width: 46px;
    /* Fixed square size */
    height: 46px;
    gap: 0;
    /* Remove gap so icon is perfectly centered */
    border-radius: 12px;
    /* Soft square look */
}

/* Ensure icon font size is good in the square */
.sidebar.collapsed .nav-link .nav-link-icon {
    font-size: 20px;
}


/* Tooltips personalizados del sidebar */
.custom-sidebar-tooltip .tooltip-arrow {
    display: none !important;
}

.custom-sidebar-tooltip .tooltip-inner {
    background-color: #1e293b;
    /* Mismo tono que el dropdown anterior para coherencia */
    color: #fff;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* ============================================
   FOOTER DEL SIDEBAR
   ============================================ */

.sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    padding: 16px;
}

.sidebar.collapsed .sidebar-footer {
    padding: 16px 8px;
    display: flex;
    justify-content: center;
}

.sidebar.collapsed .sidebar-footer .nav-items {
    width: 100%;
}

/* ============================================
   CONTENIDO PRINCIPAL
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-normal);
    min-height: 100vh;
    background: var(--bg-body);
}

.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Topbar superior minimalista */
.topbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
    backdrop-filter: blur(8px);
    min-height: 81px;
    box-sizing: border-box;
    /* Altura igual al sidebar-header para alineación perfecta */
}

/* Botones de Icono (Toggle, Theme) */
.sidebar-toggle-btn,
.theme-toggle-btn {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    font-size: 18px;
}

.sidebar-toggle-btn:hover,
.theme-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-tertiary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.theme-toggle-btn:hover {
    color: #eab308;
    /* Yellow for sun/moon hover */
}

/* Contenedor del contenido con padding */
.content-wrapper {
    padding: 32px;
    max-width: 1600px;
    margin: 0 auto;
}

/* ============================================
   DROPDOWN DE USUARIO
   ============================================ */

.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px 6px 6px;
    /* Ajuste para el avatar */
    border: 1px solid var(--border-color);
    border-radius: 999px;
    /* Pill shape */
    background: var(--bg-surface);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.user-dropdown-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--text-tertiary);
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F39200 0%, #d67e00 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

/* Dropdown Menu Styles for Dark Mode */
.dropdown-menu {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    padding: 8px;
    min-width: 220px;
    margin-top: 8px !important;
    /* Spacing */
}

.dropdown-item {
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    transform: translateX(4px);
}

.dropdown-item i {
    margin-right: 10px;
    color: var(--text-tertiary);
}

.dropdown-divider {
    border-top-color: var(--border-color);
    margin: 8px 0;
}

.dropdown-header {
    color: var(--text-secondary);
    font-weight: 600;
    padding: 8px 16px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar.collapsed~.main-content {
        margin-left: 0;
    }

    .content-wrapper {
        padding: 16px;
    }

    /* Overlay para móvil */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.6);
        /* Slate overlay */
        backdrop-filter: blur(2px);
        display: none;
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }
}

/* ============================================
   TOOLTIPS PARA SIDEBAR COLAPSADO
   ============================================ */

.sidebar.collapsed .nav-link {
    position: relative;
}

.sidebar.collapsed .nav-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    /* Slate 800 */
    color: white;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    margin-left: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1001;
    box-shadow: var(--shadow-md);
}

.sidebar.collapsed .nav-link:hover::after {
    opacity: 1;
}

/* ============================================
   ANIMACIONES
   ============================================ */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.nav-item {
    animation: slideIn 0.3s ease-out backwards;
}

.nav-item:nth-child(1) {
    animation-delay: 0.05s;
}

.nav-item:nth-child(2) {
    animation-delay: 0.1s;
}

.nav-item:nth-child(3) {
    animation-delay: 0.15s;
}

.nav-item:nth-child(4) {
    animation-delay: 0.2s;
}

.nav-item:nth-child(5) {
    animation-delay: 0.25s;
}

/* ============================================
   DARK MODE OVERRIDES & COMPONENT STYLES
   ============================================ */

/* Cards (Universal) */
.card,
[data-theme="dark"] .card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    /* Micro-interacción: Lift effect */
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header,
.card-footer {
    background-color: transparent !important;
    border-color: var(--border-color) !important;
    padding: 16px 20px;
}

[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer {
    color: var(--text-primary);
}

/* Tables */
.table {
    --bs-table-color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border-color);
}

/* Zebra striping sutil en dark mode */
[data-theme="dark"] .table-striped>tbody>tr:nth-of-type(odd)>* {
    --bs-table-accent-bg: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

[data-theme="dark"] .table-hover>tbody>tr:hover>* {
    --bs-table-accent-bg: var(--bg-hover);
    color: var(--text-primary);
}

/* Forms */
.form-control,
.form-select,
.input-group-text {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    /* Más espacio */
    font-size: 14px;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .input-group-text {
    background-color: var(--bg-body) !important;
    /* Input más oscuro que surface */
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--text-tertiary);
}

/* Buttons (Overrides) */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 500;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="dark"] .btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* Specific Component Overrides */
[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-body-secondary {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .bg-light {
    background-color: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .bg-white {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}

/* Nav Tabs (Dark Mode Fix) */
[data-theme="dark"] .nav-tabs {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .nav-tabs .nav-link {
    color: var(--text-secondary);
    border-color: transparent;
}

[data-theme="dark"] .nav-tabs .nav-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
    border-color: transparent;
}

[data-theme="dark"] .nav-tabs .nav-link.active {
    color: var(--text-primary);
    background-color: var(--bg-surface);
    border-color: var(--border-color) var(--border-color) var(--bg-surface);
    /* Bottom border transparent to blend with content */
}

/* Dashboard Cards (Specific) */
.quick-action-card,
.stat-card {
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .quick-action-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .order-card {
    background-color: var(--bg-surface) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .quick-action-card:hover,
[data-theme="dark"] .order-card:hover {
    background-color: var(--bg-surface) !important;
    border-color: var(--primary-color) !important;
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .quick-action-card h5,
[data-theme="dark"] .stat-number {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .quick-action-card small,
[data-theme="dark"] .stat-label {
    color: var(--text-secondary) !important;
}

/* ============================================
   MICRO-INTERACTIONS & UTILITIES
   ============================================ */

/* Skeleton Loading Animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: #e5e7eb;
    background-image: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 37%, #e5e7eb 63%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: var(--radius-sm);
    display: inline-block;
    height: 1em;
    width: 100%;
}

.skeleton-text {
    height: 0.8em;
    margin-bottom: 0.5em;
    width: 80%;
}

.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Dark Mode Skeleton */
[data-theme="dark"] .skeleton {
    background: #334155;
    background-image: linear-gradient(90deg, #334155 25%, #475569 37%, #334155 63%);
}

/* Custom Scrollbar (Webkit) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 5px;
    border: 2px solid var(--bg-body);
    /* Creates padding effect */
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Dark Mode Scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #475569;
    border-color: var(--bg-body);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Smooth Fade In */
/* Smooth Fade In */
.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   DARK MODE COMPREHENSIVE FIXES
   ============================================ */

[data-theme="dark"] {

    /* --- Wizard & Order Creation Fixes --- */
    .wizard-navigation,
    .cart-totals {
        background-color: var(--bg-surface) !important;
        border-color: var(--border-color) !important;
        color: var(--text-primary) !important;
    }

    .cart-sidebar,
    .wizard-step-circle {
        background-color: var(--bg-surface) !important;
        border-color: var(--border-color) !important;
        color: var(--text-secondary);
    }

    .wizard-step.active .wizard-step-circle {
        background-color: var(--primary-color) !important;
        color: white !important;
    }

    .form-section,
    .cart-item {
        background-color: var(--bg-surface) !important;
        border: 1px solid var(--border-color) !important;
        color: var(--text-primary) !important;
    }

    .variation-swatch {
        background-color: var(--bg-surface) !important;
        border-color: var(--border-color) !important;
    }

    .variation-swatch:hover {
        border-color: var(--primary-color) !important;
    }

    .variation-swatch-label {
        color: var(--text-secondary) !important;
    }

    /* --- Modal Fixes --- */
    .modal-content {
        background-color: var(--bg-surface) !important;
        border-color: var(--border-color) !important;
        color: var(--text-primary) !important;
    }

    .modal-header,
    .modal-footer {
        border-color: var(--border-color) !important;
        background-color: var(--bg-surface) !important;
    }

    .btn-close {
        filter: invert(1) grayscale(100%) brightness(200%);
    }

    /* --- Table Header Fixes (Global - All Modules) --- */
    .table-light,
    .table-light th,
    .table-light td,
    thead.table-light,
    thead.table-light th,
    /* Global override for ANY table header in dark mode to prevent white backgrounds */
    table thead,
    table th {
        background-color: var(--bg-surface) !important;
        color: var(--text-primary) !important;
        border-color: var(--border-color) !important;
    }

    /* --- Generic Background Overrides --- */
    .bg-white {
        background-color: var(--bg-surface) !important;
        color: var(--text-primary) !important;
    }

    .bg-light {
        background-color: var(--bg-surface) !important;
        color: var(--text-primary) !important;
    }

    /* --- Product Cards in Wizard --- */
    .product-card {
        background-color: var(--bg-surface);
        border-color: var(--border-color);
        color: var(--text-primary);
    }

    .product-card-name,
    .product-card-price {
        color: var(--text-primary) !important;
    }

    .product-card img {
        background-color: var(--bg-hover) !important;
        opacity: 0.8;
    }

    /* --- Inputs in Wizard --- */
    input.form-control,
    select.form-select,
    textarea.form-control {
        background-color: var(--bg-body) !important;
        border-color: var(--border-color) !important;
        color: var(--text-primary) !important;
    }
}