/* ==========================================================================
   FinDash - Dashboard Module Styles (dash/inc/css/style.css)
   ========================================================================== */

/* Theme & Critical Background Paint Fallbacks */
html, body, .overflow-y-auto {
    scrollbar-gutter: stable;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    overflow: hidden;
}

body.theme-transition {
    transition: background-color 0.3s, color 0.3s;
}

html.dark, html.dark body {
    background-color: #030712 !important; /* bg-gray-950 */
    color: #f3f4f6 !important;
}

html:not(.dark), html:not(.dark) body {
    background-color: #f9fafb !important; /* bg-gray-50 */
    color: #000000;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.25); /* Indigo-blue tint */
    border-radius: 9999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5); /* Darker indigo-blue on hover */
    border-radius: 9999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
html, body, .overflow-y-auto, .overflow-x-auto, div {
    scrollbar-color: rgba(99, 102, 241, 0.25) transparent;
    scrollbar-width: thin;
}

/* Tab Content Transitions & Container Layout */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.dashboard-container, .dashboard-container * {
    text-align: left;
}

/* Navigation & Clarity+ Styling */
.clarity-plus-icon {
    stroke: url(#clarity-gradient) !important;
}
.bg-gradient-to-r .clarity-plus-icon {
    stroke: #ffffff !important;
}
@keyframes spin-slow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.animate-spin-slow {
    animation: spin-slow 12s linear infinite;
}

/* Customer Support Portal Dropdowns */
select[name="category"], select[name="priority"] {
    background-color: #f0f2fe !important;
    color: #4338ca !important;
    border-color: #c7d2fe !important;
}
.dark select[name="category"], .dark select[name="priority"] {
    background-color: #090d16 !important;
    color: #ffffff !important;
    border-color: #374151 !important;
}
select[name="category"] option, select[name="priority"] option {
    background-color: #ffffff !important;
    color: #0f172a !important;
}
.dark select[name="category"] option, .dark select[name="priority"] option {
    background-color: #090d16 !important;
    color: #ffffff !important;
}

/* ==========================================================================
   PREMIUM THEME ENGINE OVERRIDES html.dark[data-theme]
   ========================================================================== */

/* 1. Sunset Rose */
html.dark[data-theme="sunset"] {
    --theme-bg: #1c0517 !important;
    --theme-card-bg: #3b072c !important;
    --theme-card-border: #701a55 !important;
    --theme-text-primary: #fff1f2 !important;
    --theme-text-secondary: #fecdd3 !important;
    --theme-accent: #f43f5e !important;
}

/* 2. Cyberpunk Neon */
html.dark[data-theme="cyberpunk"] {
    --theme-bg: #090919 !important;
    --theme-card-bg: #0f172a !important;
    --theme-card-border: #1e293b !important;
    --theme-text-primary: #f0f9ff !important;
    --theme-text-secondary: #bae6fd !important;
    --theme-accent: #06b6d4 !important;
}

/* 3. Onyx Gold (Executive Luxury) */
html.dark[data-theme="onyx"] {
    --theme-bg: #090a0f !important;
    --theme-card-bg: #13151f !important;
    --theme-card-border: #2a2d3d !important;
    --theme-text-primary: #fffbeb !important;
    --theme-text-secondary: #fde68a !important;
    --theme-accent: #f59e0b !important;
}

/* 4. Nordic Sapphire (Deep Abyss) */
html.dark[data-theme="sapphire"] {
    --theme-bg: #060d1a !important;
    --theme-card-bg: #0c192e !important;
    --theme-card-border: #182e4d !important;
    --theme-text-primary: #f0f9ff !important;
    --theme-text-secondary: #7dd3fc !important;
    --theme-accent: #38bdf8 !important;
}

/* Universal Background & Container Overrides (Dark Mode Only) */
html.dark[data-theme] body,
html.dark[data-theme] .dashboard-container,
html.dark[data-theme] #main-content-pane,
html.dark[data-theme] main {
    background-color: var(--theme-bg) !important;
    color: var(--theme-text-primary) !important;
}

/* Sidebar & Top Navigation Bar Overrides (Dark Mode Only) */
html.dark[data-theme] aside#sidebar,
html.dark[data-theme] aside,
html.dark[data-theme] .lg\:hidden.flex.items-center.justify-between {
    background-color: var(--theme-card-bg) !important;
    border-color: var(--theme-card-border) !important;
}

/* All Cards, Div Boxes, Container Sections Overrides (Dark Mode Only) */
html.dark[data-theme] [class*="dark:bg-gray-900"],
html.dark[data-theme] [class*="dark:bg-gray-950"],
html.dark[data-theme] [class*="dark:bg-slate-900"],
html.dark[data-theme] [class*="dark:bg-slate-950"] {
    background-color: var(--theme-card-bg) !important;
    border-color: var(--theme-card-border) !important;
}

/* Card Borders Overrides (Dark Mode Only) */
html.dark[data-theme] [class*="dark:border-gray-800"],
html.dark[data-theme] [class*="dark:border-gray-700"],
html.dark[data-theme] [class*="dark:border-slate-800"],
html.dark[data-theme] [class*="dark:border-slate-700"] {
    border-color: var(--theme-card-border) !important;
}

/* Text Colors Overrides (Dark Mode Only) */
html.dark[data-theme] .dark\:text-white {
    color: var(--theme-text-primary) !important;
}

html.dark[data-theme] .dark\:text-gray-300,
html.dark[data-theme] .dark\:text-gray-400 {
    color: var(--theme-text-secondary) !important;
}

/* Scrollbar Tinting (Dark Mode Only) */
html.dark[data-theme] ::-webkit-scrollbar-thumb {
    background: var(--theme-accent) !important;
}

/* ==========================================================================
   AUTHENTICATION & LOGIN SCREEN STYLES
   ========================================================================== */

/* Outer Auth View Background */
.auth-background {
    background-color: #f9fafb;
}

html.dark .auth-background {
    background-color: #090d16;
    background-image: linear-gradient(135deg, #4c1d95 0%, #9333ea 100%);
}

html.dark[data-theme="cyberpunk"] .auth-background {
    background-image: linear-gradient(135deg, #090014 0%, #20003b 100%);
}

html.dark[data-theme="sunset"] .auth-background {
    background-image: linear-gradient(135deg, #2b091e 0%, #4a1236 100%);
}

html.dark[data-theme="onyx"] .auth-background {
    background-image: linear-gradient(135deg, #09090b 0%, #1c1917 100%);
}

html.dark[data-theme="sapphire"] .auth-background {
    background-image: linear-gradient(135deg, #030712 0%, #0b192e 100%);
}

/* Auth Glass Card Container */
.auth-card {
    background-color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

html.dark .auth-card {
    background-color: rgba(17, 24, 39, 0.5);
    border: 1px solid rgba(55, 65, 81, 0.5);
}

/* Auth Submit Button */
.auth-submit-btn {
    background: linear-gradient(90deg, #4c1d95 0%, #9333ea 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px 0 rgba(76, 29, 149, 0.3);
    transition: all 0.2s ease-in-out;
}

.auth-submit-btn:hover {
    filter: brightness(110%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(76, 29, 149, 0.4);
}

html.dark[data-theme="cyberpunk"] .auth-submit-btn {
    background: linear-gradient(90deg, #d946ef 0%, #06b6d4 100%);
    box-shadow: 0 4px 14px 0 rgba(217, 70, 239, 0.3);
}

html.dark[data-theme="sunset"] .auth-submit-btn {
    background: linear-gradient(90deg, #f43f5e 0%, #fb923c 100%);
    box-shadow: 0 4px 14px 0 rgba(244, 63, 94, 0.3);
}

html.dark[data-theme="onyx"] .auth-submit-btn {
    background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
    box-shadow: 0 4px 14px 0 rgba(217, 119, 6, 0.3);
}

html.dark[data-theme="sapphire"] .auth-submit-btn {
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.3);
}

/* Ambient Glow Circle */
.auth-ambient-glow {
    background-color: rgba(99, 102, 241, 0.1);
}

/* Auth Input Fields Styling */
.auth-card input,
.auth-card select,
.auth-card textarea {
    background-color: rgba(255, 255, 255, 0.95) !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

html.dark .auth-card input,
html.dark .auth-card select,
html.dark .auth-card textarea {
    background-color: rgba(15, 23, 42, 0.85) !important;
    color: #f8fafc !important;
    border: 1px solid rgba(51, 65, 85, 0.8) !important;
}

html.dark[data-theme] .auth-card input,
html.dark[data-theme] .auth-card select,
html.dark[data-theme] .auth-card textarea {
    background-color: rgba(0, 0, 0, 0.45) !important;
    color: var(--theme-text-primary, #ffffff) !important;
    border: 1px solid var(--theme-card-border, #374151) !important;
}

html.dark .auth-card input:focus,
html.dark .auth-card select:focus,
html.dark .auth-card textarea:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25) !important;
}

html.dark[data-theme] .auth-card input:focus,
html.dark[data-theme] .auth-card select:focus,
html.dark[data-theme] .auth-card textarea:focus {
    border-color: var(--theme-accent, #6366f1) !important;
    box-shadow: 0 0 0 2px var(--theme-accent, #6366f1) !important;
}

/* ==========================================================================
   BROWSER AUTOFILL OVERRIDES (Chrome, Edge, Safari, Firefox)
   Fixes white-on-white / light-on-light unreadable autofill text & dots
   ========================================================================== */

/* Light Mode Autofill */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    box-shadow: 0 0 0 1000px #ffffff inset !important;
    -webkit-text-fill-color: #0f172a !important;
    caret-color: #0f172a !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Dark Mode Autofill */
html.dark input:-webkit-autofill,
html.dark input:-webkit-autofill:hover, 
html.dark input:-webkit-autofill:focus, 
html.dark input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #0f172a inset !important;
    box-shadow: 0 0 0 1000px #0f172a inset !important;
    -webkit-text-fill-color: #f8fafc !important;
    caret-color: #f8fafc !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Themed Dark Mode Autofill */
html.dark[data-theme] input:-webkit-autofill,
html.dark[data-theme] input:-webkit-autofill:hover, 
html.dark[data-theme] input:-webkit-autofill:focus, 
html.dark[data-theme] input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--theme-card-bg, #0f172a) inset !important;
    box-shadow: 0 0 0 1000px var(--theme-card-bg, #0f172a) inset !important;
    -webkit-text-fill-color: var(--theme-text-primary, #ffffff) !important;
    caret-color: var(--theme-text-primary, #ffffff) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Explicit Specific Theme Autofill Backgrounds */
html.dark[data-theme="sunset"] input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #3b072c inset !important;
    box-shadow: 0 0 0 1000px #3b072c inset !important;
    -webkit-text-fill-color: #fff1f2 !important;
}
html.dark[data-theme="cyberpunk"] input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #0f172a inset !important;
    box-shadow: 0 0 0 1000px #0f172a inset !important;
    -webkit-text-fill-color: #f0f9ff !important;
}
html.dark[data-theme="onyx"] input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #13151f inset !important;
    box-shadow: 0 0 0 1000px #13151f inset !important;
    -webkit-text-fill-color: #fffbeb !important;
}
html.dark[data-theme="sapphire"] input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #0c192e inset !important;
    box-shadow: 0 0 0 1000px #0c192e inset !important;
    -webkit-text-fill-color: #f0f9ff !important;
}

