/* =================================================
   🚨 FILAMENT OVERRIDE - GOD TIER SPECIFICITY 🚨
   ================================================= */

/* Global Background - Onyx Standard */
html.dark .fi-body {
    background-color: #060606 !important;
    background-image:
        radial-gradient(at 0% 0%, rgba(245, 158, 11, 0.04) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(245, 158, 11, 0.02) 0px, transparent 50%) !important;
    background-attachment: fixed !important;
}

html.dark .fi-main {
    background: transparent !important;
}

/* Sidebar - Premium Glassmorphism */
html.dark .fi-sidebar {
    background: rgba(10, 10, 10, 0.7) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.05) !important;
}

html.dark .fi-sidebar-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03) !important;
}

/* Nav Items */
html.dark .fi-sidebar-item-button {
    border-radius: 14px !important;
    margin: 4px 12px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

html.dark .fi-sidebar-item-button:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

html.dark .fi-sidebar-item-active .fi-sidebar-item-button {
    background: rgba(245, 158, 11, 0.1) !important;
    border: 1px solid rgba(245, 158, 11, 0.2) !important;
    color: #f59e0b !important;
}

html.dark .fi-sidebar-item-active .fi-sidebar-item-icon {
    color: #f59e0b !important;
}

/* Topbar - Crystal Clean */
html.dark .fi-topbar {
    background: rgba(6, 6, 6, 0.6) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* Widgets & Sections - Glass Tier (Absolute Priority) */
html.dark .fi-wi-stats-overview-stat-wrp,
html.dark .fi-section,
html.dark .fi-ta-ctn,
html.dark .fi-wi-widget-wrp>div {
    background: rgba(18, 18, 18, 0.5) !important;
    backdrop-filter: blur(40px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(200%) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    transition: all 0.4s ease !important;
}

html.dark .fi-section:focus-within {
    z-index: 99 !important;
    position: relative !important;
}

html.dark .fi-wi-stats-overview-stat-wrp:hover {
    border-color: rgba(245, 158, 11, 0.3) !important;
    transform: translateY(-4px) !important;
    background: rgba(25, 25, 25, 0.6) !important;
}

html.dark .fi-wi-stats-overview-stat-value {
    color: #ffffff !important;
    font-weight: 900 !important;
    letter-spacing: -0.01em !important;
}

html.dark .fi-wi-stats-overview-stat-label {
    color: rgba(255, 255, 255, 0.45) !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    font-size: 0.6rem !important;
    letter-spacing: 0.15em !important;
}

/* Tables - Professional Minimalist */
html.dark .fi-ta-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03) !important;
}

html.dark .fi-ta-header-cell {
    background: transparent !important;
    text-transform: uppercase !important;
    font-size: 0.6rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.1em !important;
    color: rgba(255, 255, 255, 0.35) !important;
    padding: 1rem !important;
}

html.dark .fi-ta-row {
    transition: all 0.2s ease !important;
}

html.dark .fi-ta-row:hover {
    background: rgba(255, 255, 255, 0.02) !important;
}

/* Buttons in Dashboard (Aggressive Override) */
html.dark .fi-btn-color-primary,
html.dark .fi-btn-color-primary:hover {
    background: #ffffff !important;
    color: #000000 !important;
    border-radius: 12px !important;
    font-weight: 800 !important;
    letter-spacing: 0.05em !important;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15) !important;
}

html.dark .fi-btn-color-primary:hover {
    background: #f59e0b !important;
    color: #ffffff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px -5px rgba(245, 158, 11, 0.5) !important;
}

/* Input Fields */
html.dark .fi-input-wrp {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5) !important;
}

html.dark .fi-input-wrp:focus-within {
    border-color: #f59e0b !important;
    background: #000 !important;
    z-index: 50 !important;
    position: relative !important;
}

/* Fix Dropdowns being buried under glass sections */
html.dark .choices__list--dropdown {
    z-index: 1000 !important;
    background: #121212 !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8) !important;
    backdrop-filter: blur(20px) !important;
}

/* Breadcrumbs */
html.dark .fi-breadcrumbs-item-label {
    color: rgba(255, 255, 255, 0.4) !important;
    font-weight: 700 !important;
}

html.dark .fi-breadcrumbs-item-active .fi-breadcrumbs-item-label {
    color: #ffffff !important;
}

/* Custom Scrollbar */
html.dark ::-webkit-scrollbar {
    width: 6px;
}

html.dark ::-webkit-scrollbar-track {
    background: #060606;
}

html.dark ::-webkit-scrollbar-thumb {
    background: #222;
    border-radius: 10px;
}

html.dark ::-webkit-scrollbar-thumb:hover {
    background: #333;
}

/* =============================================
   3. APEX LOGIN PAGE (Responsive Themes)
   ============================================= */
.fi-wn-login-page {
    position: relative !important;
    min-height: 100vh !important;
    width: 100vw !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #060606 !important;
    /* Force dark background even in light mode for auth */
    z-index: 10 !important;
    overflow: hidden !important;
    font-family: 'Outfit', sans-serif !important;
    color: #ffffff !important;
}

/* Ensure Auth Card is always readable */
.fi-wn-login-page .fi-wn-login-card {
    background: rgba(25, 25, 25, 0.7) !important;
    color: #ffffff !important;
}

/* --- LIGHT MODE FALLBACKS (Massive Contrast Fix) --- */
html:not(.dark) .fi-body {
    background-color: #f8fafc !important;
}

html:not(.dark) .fi-sidebar {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(12px) !important;
    border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
}

html:not(.dark) .fi-sidebar-item-label {
    color: #334155 !important;
}

html:not(.dark) .fi-sidebar-item-button:hover .fi-sidebar-item-label {
    color: #0f172a !important;
}

html:not(.dark) .fi-sidebar-item-button:hover {
    background: rgba(0, 0, 0, 0.05) !important;
}

html:not(.dark) .fi-sidebar-item-active .fi-sidebar-item-button {
    background: rgba(245, 158, 11, 0.08) !important;
    border: 1px solid rgba(245, 158, 11, 0.2) !important;
}

html:not(.dark) .fi-wi-stats-overview-stat-wrp,
html:not(.dark) .fi-section,
html:not(.dark) .fi-ta-ctn,
html:not(.dark) .fi-wi-widget-wrp>div {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.05) !important;
}

/* Force dark text in light mode for all stats and sections */
html:not(.dark) .fi-wi-stats-overview-stat-value,
html:not(.dark) .fi-section-header-heading,
html:not(.dark) .fi-ta-header-cell,
html:not(.dark) .fi-ta-text-column,
html:not(.dark) .fi-breadcrumbs-item-label {
    color: #0f172a !important;
}

html:not(.dark) .fi-wi-stats-overview-stat-label,
html:not(.dark) .fi-section-header-description,
html:not(.dark) .fi-ta-text-column-description {
    color: #64748b !important;
}

/* Buttons in Light Mode */
html:not(.dark) .fi-btn-color-primary {
    background: #0f172a !important;
    color: #ffffff !important;
}

html:not(.dark) .fi-btn-color-primary:hover {
    background: #f59e0b !important;
    color: #ffffff !important;
}