/* ===================================
   Theme System - Light/Dark Mode
   Based on Figma Design System
   =================================== */

/* Smooth transitions for theme switching */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, fill 0.3s ease, stroke 0.3s ease;
}

/* Disable transitions for specific elements that shouldn't animate */
*:focus,
*:active,
input,
textarea,
select {
    transition: none;
}

/* Light Mode Colors (Default) */
:root,
[data-bs-theme="light"] {
    /* Grays - Light Mode */
    --gray-50: #F8F9FA;
    --gray-100: #ECEFF2;
    --gray-200: #D9DEE3;
    --gray-300: #B8C0C9;
    --gray-400: #8F9AA5;
    --gray-500: #6B7682;
    --gray-600: #404C58;
    --gray-700: #2E3A46;
    --gray-800: #1D2934;
    --gray-900: #131E1E;
    
    /* Blues - Light Mode */
    --blue-50: #E8F3FE;
    --blue-100: #C9E4FD;
    --blue-200: #9BCBFA;
    --blue-300: #6BA7F5;
    --blue-400: #3C8BF1;
    --blue-500: #1669E8;
    --blue-600: #125AD1;
    --blue-700: #0F4FB9;
    --blue-800: #0C4096;
    --blue-900: #082B66;
    
    /* Yellows - Light Mode */
    --yellow-50: #FFFBEA;
    --yellow-100: #FFF3C4;
    --yellow-200: #FDE68A;
    --yellow-300: #FCD34D;
    --yellow-400: #FBB824;
    --yellow-500: #DA822C;
    --yellow-600: #C48A1E;
    --yellow-700: #A1841B;
    --yellow-800: #846813;
    --yellow-900: #7C4B0D;
    
    /* Semantic Colors - Light Mode */
    --bg-canvas: #FFFFFF;
    --bg-primary: #F8F9FA;
    --bg-secondary: #ECEFF2;
    --bg-surface: #FFFFFF;
    --bg-surface-dark: #D9DEE3;
    
    --fg-default: #131E1E;
    --fg-secondary: #404C58;
    --fg-tertiary: #6B7682;
    --fg-muted: #8F9AA5;
    
    --border-primary: #D9DEE3;
    --border-secondary: #ECEFF2;
    
    --btn-primary: #1669E8;
    --btn-primary-hover: #125AD1;
    --btn-primary-active: #0F4FB9;
    
    --accent-gold: #C48A1E;
    --accent-blue: #1669E8;
    
    --link-color: #1669E8;
    --link-hover: #125AD1;
}

/* Dark Mode Colors */
[data-bs-theme="dark"] {
    /* Grays - Dark Mode (inverted) */
    --gray-50: #131E1E;
    --gray-100: #1D2934;
    --gray-200: #2E3A46;
    --gray-300: #404C58;
    --gray-400: #6B7682;
    --gray-500: #8F9AA5;
    --gray-600: #B8C0C9;
    --gray-700: #D9DEE3;
    --gray-800: #ECEFF2;
    --gray-900: #F8F9FA;
    
    /* Blues - Dark Mode */
    --blue-50: #082B66;
    --blue-100: #0C4096;
    --blue-200: #0F4FB9;
    --blue-300: #125AD1;
    --blue-400: #1669E8;
    --blue-500: #3C8BF1;
    --blue-600: #6BA7F5;
    --blue-700: #9BCBFA;
    --blue-800: #C9E4FD;
    --blue-900: #E8F3FE;
    
    /* Yellows - Dark Mode */
    --yellow-50: #7C4B0D;
    --yellow-100: #846813;
    --yellow-200: #A1841B;
    --yellow-300: #C48A1E;
    --yellow-400: #DA822C;
    --yellow-500: #FBB824;
    --yellow-600: #FCD34D;
    --yellow-700: #FDE68A;
    --yellow-800: #FFF3C4;
    --yellow-900: #FFFBEA;
    
    /* Semantic Colors - Dark Mode */
    --bg-canvas: #000000;
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-surface: #0d1117;
    --bg-surface-dark: #252c34;
    
    --fg-default: #f8f9fa;
    --fg-secondary: #b8c0c9;
    --fg-tertiary: #8f9aa5;
    --fg-muted: #6B7682;
    
    --border-primary: #333c46;
    --border-secondary: #252c34;
    
    --btn-primary: #1669e8;
    --btn-primary-hover: #1557c7;
    --btn-primary-active: #125AD1;
    
    --accent-gold: #c49a1e;
    --accent-blue: #3C8BF1;
    
    --link-color: #3C8BF1;
    --link-hover: #6BA7F5;
}

/* Theme Toggle Button - Icon Only in Header */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--fg-secondary);
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
    border-radius: 4px;
}

.theme-toggle:hover {
    color: var(--fg-default);
    background-color: var(--bg-secondary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Hide icons based on theme */
[data-bs-theme="light"] .theme-toggle .icon-moon {
    display: block;
}

[data-bs-theme="light"] .theme-toggle .icon-sun {
    display: none;
}

[data-bs-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

[data-bs-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

/* Smooth transitions for theme changes */
body,
.client-header,
.client-nav-link,
.mobile-menu,
.account-tab,
.coverage-item,
.page-header-section,
.main-content {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Mobile Menu Theme Support */
.mobile-menu {
    background-color: var(--bg-canvas);
    border-top: 1px solid var(--border-primary);
}

.mobile-nav-link {
    color: var(--fg-secondary);
    border-bottom: 1px solid var(--border-primary);
}

.mobile-nav-link:hover {
    color: var(--fg-default);
    background-color: var(--bg-secondary);
}

.mobile-nav-link.active {
    color: var(--accent-blue);
}

/* Client Nav Theme Toggle Spacing */
.client-nav .theme-toggle {
    margin-left: -20px;
}

/* Public Nav Theme Toggle Spacing */
.nav-actions .theme-toggle {
    margin-left: 0px;
}

/* Ensure proper contrast for all interactive elements */
button,
a,
input,
select,
textarea {
    color: inherit;
}

/* Override Bootstrap's default theme colors if needed */
.btn-primary {
    background-color: var(--btn-primary);
    border-color: var(--btn-primary);
}

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

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

/* Logo Swap for Light/Dark Mode - Handled by JavaScript in theme.js */

/* Hero Background Image Swap for Light/Dark Mode */
/* Dark mode: default hero-background.png */
.hero-section {
    background-image: url('../assets/images/hero-background.png');
}

/* Light mode: hero-background-inverted.png */
[data-bs-theme="light"] .hero-section {
    background-image: url('../assets/images/hero-background-inverted.png');
}

/* Remove dark overlay in light mode */
[data-bs-theme="light"] .hero-section::before {
    background-color: transparent;
}

/* Coverage Table - Light Mode Fixes */
[data-bs-theme="light"] .coverage-table thead {
    background-color: #e5e7eb;
}

[data-bs-theme="light"] .coverage-table th {
    color: #1f2937;
}

/* Client Nav SVG Images - Invert for Light Mode */
[data-bs-theme="light"] .dealbase-logo,
[data-bs-theme="light"] .dropdown-icon {
    filter: invert(1) brightness(0.2);
}
