/* ============================================================================
   THETRIEYES — CENTRALIZED THEME ENGINE
   File: public/css/theme.css

   Deep Navy + Titanium Silver identity:
   - Deep Navy:         #101C35
   - Secondary Navy:    #172844
   - Dark Navy:         #0B1425
   - Titanium Silver:   #AEBBCC
   - Light Titanium:    #DCE2EA
   - Premium White:     #F4F6FA
   - Page Background:   #F5F7FA
   - Card Background:   #FFFFFF
   - Heading:           #101828
   - Body Text:         #596579
   - Border:            #DFE5ED
   - Primary Hover:     #263D60

   Scope: Storefront, customer portal, admin dashboard, dealer ERP and staff
   portal. This file changes design tokens only; it does not change layouts,
   component dimensions, routes, application logic or database behaviour.

   Theme switching:
   - Light: remove data-theme="dark" from <html>
   - Dark:  <html data-theme="dark">
   - Admin dark: <html data-admin-theme="dark">
   - Presets: <html data-theme-preset="festive-gold">
   ============================================================================ */


/* ============================================================================
   1. LIGHT MODE — DEFAULT BRAND TOKENS
   ============================================================================ */

:root {
  color-scheme: light;

  /* Centralized Icon Color — Single source of truth for all website icons */
  --theme-icon-color: #FFFFFF;

  /* Brand primary — Deep Navy + Titanium Silver */
  --theme-primary: #101C35;
  --theme-primary-hover: #263D60;
  --theme-primary-active: #0B1425;
  --theme-primary-soft: rgba(16, 28, 53, 0.08);
  --theme-primary-border: rgba(16, 28, 53, 0.22);
  --theme-primary-glow: rgba(16, 28, 53, 0.18);

  /* Deep Navy Brand Palette */
  --deep-navy: #101C35;
  --secondary-navy: #172844;
  --dark-navy: #0B1425;
  --titanium-silver: #AEBBCC;
  --light-titanium: #DCE2EA;
  --premium-white: #F4F6FA;

  /* Supporting accent — Titanium Silver */
  --theme-accent: #AEBBCC;
  --theme-accent-hover: #DCE2EA;
  --theme-accent-active: #8A9BA8;
  --theme-accent-soft: rgba(174, 187, 204, 0.16);
  --theme-accent-border: rgba(174, 187, 204, 0.35);
  --theme-accent-glow: rgba(174, 187, 204, 0.25);

  /* Page and surfaces */
  --theme-page: #F5F7FA;
  --theme-surface: #FFFFFF;
  --theme-section: #F4F6FA;
  --theme-card: #FFFFFF;
  --theme-card-hover: #F8FAFC;
  --theme-card-border: #DFE5ED;

  /* Typography */
  --theme-heading: #101828;
  --theme-text: #596579;
  --theme-muted: #808D9E;
  --theme-secondary: #1E293B;

  /* Borders */
  --theme-border: #DFE5ED;
  --theme-border-subtle: #EEF2F6;
  --theme-border-focus: var(--theme-primary);

  /* Semantic states */
  --theme-sale: #E03131;
  --theme-success: #12B886;
  --theme-warning: #F59F00;
  --theme-danger: #FA5252;
  --theme-info: #228BE6;

  /* Elevation */
  --theme-shadow-xs: 0 1px 3px rgba(16, 28, 53, 0.04);
  --theme-shadow-sm: 0 4px 16px rgba(16, 28, 53, 0.06);
  --theme-shadow: 0 8px 28px rgba(16, 28, 53, 0.08);
  --theme-shadow-md: 0 14px 40px rgba(16, 28, 53, 0.11);
  --theme-shadow-lg: 0 26px 70px rgba(16, 28, 53, 0.15);

  --gold: var(--theme-primary);
  --gold-rich: var(--theme-primary-hover);
  --gold-soft: var(--theme-primary-soft);
  --dealer-primary: var(--theme-primary);
  --dealer-primary-dark: var(--theme-primary-hover);
  --dealer-accent: var(--theme-accent);
  --accent: var(--theme-accent);
  --ivory: var(--theme-page);
  --white: var(--theme-surface);
  --cream: var(--theme-section);
  --beige: var(--theme-card);
  --brown: var(--theme-text);
  --brown-dark: var(--theme-heading);
  --ink: var(--theme-heading);
  --line: var(--theme-border);
  --sale: var(--theme-sale);
  --muted: var(--theme-muted);

  --dark-page: var(--theme-page);
  --dark-surface: var(--theme-surface);
  --dark-raised: var(--theme-section);
  --dark-border: var(--theme-border);
  --dark-text: var(--theme-text);
  --dark-muted: var(--theme-muted);

  --admin-bg: var(--theme-page);
  --admin-sidebar: var(--theme-surface);
  --admin-surface: var(--theme-surface);
  --admin-surface-raised: var(--theme-card);
  --admin-border: var(--theme-border);
  --admin-text: var(--theme-heading);
  --admin-text-muted: var(--theme-muted);
}


/* ============================================================================
   2. DARK MODE — HIGH CONTRAST DEEP NAVY + TITANIUM SILVER
   Triggered by:
   - <html data-theme="dark">
   - <html data-admin-theme="dark">
   - :root[data-theme="dark"]
   - :root[data-admin-theme="dark"]
   ============================================================================ */

:root[data-theme="dark"],
:root[data-admin-theme="dark"],
html[data-theme="dark"],
html[data-admin-theme="dark"] {
  color-scheme: dark;

  /* Centralized Icon Color in Dark Mode */
  --theme-icon-color: #FFFFFF;

  /* Brand primary in dark mode */
  --theme-primary: #38BDF8;
  --theme-primary-hover: #7DD3FC;
  --theme-primary-active: #0284C7;
  --theme-primary-soft: rgba(56, 189, 248, 0.15);
  --theme-primary-border: rgba(56, 189, 248, 0.35);
  --theme-primary-glow: rgba(56, 189, 248, 0.25);

  /* Deep Navy Brand Palette in Dark Mode */
  --deep-navy: #101C35;
  --secondary-navy: #172844;
  --dark-navy: #0B1425;
  --titanium-silver: #AEBBCC;
  --light-titanium: #DCE2EA;
  --premium-white: #F4F6FA;

  /* Supporting accent — Titanium Silver */
  --theme-accent: #AEBBCC;
  --theme-accent-hover: #DCE2EA;
  --theme-accent-active: #8A9BA8;
  --theme-accent-soft: rgba(174, 187, 204, 0.16);
  --theme-accent-border: rgba(174, 187, 204, 0.35);

  /* Page and dark surfaces — Deep Navy Palette */
  --theme-page: #0B1425;
  --theme-surface: #101C35;
  --theme-section: #172844;
  --theme-card: #101C35;
  --theme-card-hover: #172844;
  --theme-card-border: #1E2D4A;

  /* Typography in dark mode */
  --theme-heading: #F4F6FA;
  --theme-text: #AEBBCC;
  --theme-muted: #808D9E;
  --theme-secondary: #DCE2EA;

  /* Borders in dark mode */
  --theme-border: #1E2D4A;
  --theme-border-subtle: #152238;
  --theme-border-focus: #38BDF8;

  /* Semantic states in dark mode */
  --theme-sale: #F87171;
  --theme-success: #34D399;
  --theme-warning: #FBBF24;
  --theme-danger: #F87171;
  --theme-info: #60A5FA;

  /* Elevation in dark mode */
  --theme-shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.40);
  --theme-shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.50);
  --theme-shadow: 0 8px 28px rgba(0, 0, 0, 0.60);
  --theme-shadow-md: 0 14px 40px rgba(0, 0, 0, 0.70);
  --theme-shadow-lg: 0 26px 70px rgba(0, 0, 0, 0.80);

  --gold: var(--theme-primary);
  --gold-rich: var(--theme-primary-hover);
  --gold-soft: var(--theme-primary-soft);
  --dealer-primary: var(--theme-primary);
  --dealer-primary-dark: var(--theme-primary-hover);
  --dealer-accent: var(--theme-accent);
  --dealer-bg: var(--theme-card);
  --accent: var(--theme-accent);
  --ivory: var(--theme-page);
  --white: var(--theme-surface);
  --cream: var(--theme-section);
  --beige: var(--theme-card);
  --brown: var(--theme-text);
  --brown-dark: var(--theme-heading);
  --ink: var(--theme-heading);
  --line: var(--theme-border);
  --sale: var(--theme-sale);
  --muted: var(--theme-muted);

  --dark-page: var(--theme-page);
  --dark-surface: var(--theme-surface);
  --dark-raised: var(--theme-section);
  --dark-border: var(--theme-border);
  --dark-text: var(--theme-text);
  --dark-muted: var(--theme-muted);

  --admin-bg: var(--theme-page);
  --admin-sidebar: var(--theme-surface);
  --admin-surface: var(--theme-surface);
  --admin-surface-raised: var(--theme-card);
  --admin-border: var(--theme-border);
  --admin-text: var(--theme-heading);
  --admin-text-muted: var(--theme-muted);
}


/* ============================================================================
   3. CENTRAL PRIMARY COLOR UTILITIES & OVERRIDES
   ============================================================================ */

.bg-gold {
  background-color: var(--theme-primary) !important;
}
.text-gold {
  color: var(--theme-primary) !important;
}
.border-gold {
  border-color: var(--theme-primary) !important;
}
.btn-gold {
  background: var(--theme-primary) !important;
  border-color: var(--theme-primary) !important;
  color: #ffffff !important;
}
.btn-gold:hover {
  background: var(--theme-primary-hover) !important;
  border-color: var(--theme-primary-hover) !important;
  color: #ffffff !important;
}
.btn-dealer-primary,
.btn-dealer-gold {
  background-color: var(--theme-primary) !important;
  border-color: var(--theme-primary) !important;
  color: #ffffff !important;
}
.btn-dealer-primary:hover,
.btn-dealer-gold:hover {
  background-color: var(--theme-primary-hover) !important;
  border-color: var(--theme-primary-hover) !important;
  color: #ffffff !important;
}

/* Deep Navy + Titanium Silver button utilities */
.btn-navy-titanium {
  background: #101C35 !important;
  border: 1px solid #263D60 !important;
  color: #F4F6FA !important;
  box-shadow: 0 4px 14px rgba(16, 28, 53, 0.25);
  transition: all 0.25s ease;
}
.btn-navy-titanium:hover {
  background: #263D60 !important;
  border-color: #AEBBCC !important;
  color: #FFFFFF !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(16, 28, 53, 0.35);
}
.btn-outline-titanium {
  background: transparent !important;
  border: 1.5px solid #AEBBCC !important;
  color: #101C35 !important;
  transition: all 0.25s ease;
}
.btn-outline-titanium:hover {
  background: #AEBBCC !important;
  border-color: #AEBBCC !important;
  color: #101C35 !important;
  transform: translateY(-2px);
}
[data-theme="dark"] .btn-outline-titanium {
  border-color: #AEBBCC !important;
  color: #F4F6FA !important;
}
[data-theme="dark"] .btn-outline-titanium:hover {
  background: #AEBBCC !important;
  color: #0B1425 !important;
}


/* ============================================================================
   4. DARK MODE GLOBAL COMPONENT STYLING
   Preserves contrast across Storefront, Dealer ERP, and Admin Dashboard.
   ============================================================================ */

html[data-theme="dark"] body,
html[data-admin-theme="dark"] body {
  background-color: var(--theme-page) !important;
  color: var(--theme-text) !important;
}

html[data-theme="dark"] .card,
html[data-admin-theme="dark"] .card,
html[data-theme="dark"] .theme-premium-card,
html[data-admin-theme="dark"] .theme-premium-card {
  background-color: var(--theme-card) !important;
  border-color: var(--theme-card-border) !important;
  color: var(--theme-text) !important;
}

html[data-theme="dark"] .card-header,
html[data-admin-theme="dark"] .card-header {
  background-color: var(--theme-surface) !important;
  border-bottom: 1px solid var(--theme-border) !important;
  color: var(--theme-heading) !important;
}

html[data-theme="dark"] .card-footer,
html[data-admin-theme="dark"] .card-footer {
  background-color: var(--theme-surface) !important;
  border-top: 1px solid var(--theme-border) !important;
}

html[data-theme="dark"] .table,
html[data-admin-theme="dark"] .table {
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

html[data-theme="dark"] .table th,
html[data-admin-theme="dark"] .table th,
html[data-theme="dark"] .thead-light th,
html[data-admin-theme="dark"] .thead-light th {
  background-color: var(--theme-surface) !important;
  color: var(--theme-heading) !important;
  border-color: var(--theme-border) !important;
}

html[data-theme="dark"] .table td,
html[data-admin-theme="dark"] .table td {
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

html[data-theme="dark"] .table-hover tbody tr:hover,
html[data-admin-theme="dark"] .table-hover tbody tr:hover {
  background-color: var(--theme-card-hover) !important;
}

html[data-theme="dark"] .form-control,
html[data-admin-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-admin-theme="dark"] .form-select {
  background-color: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-heading) !important;
}

html[data-theme="dark"] .form-control:focus,
html[data-admin-theme="dark"] .form-control:focus {
  border-color: var(--theme-primary) !important;
  background-color: var(--theme-surface) !important;
  color: var(--theme-heading) !important;
}

html[data-theme="dark"] .form-control::placeholder,
html[data-admin-theme="dark"] .form-control::placeholder {
  color: var(--theme-muted) !important;
}

html[data-theme="dark"] .input-group-text,
html[data-admin-theme="dark"] .input-group-text {
  background-color: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-muted) !important;
}

html[data-theme="dark"] .modal-content,
html[data-admin-theme="dark"] .modal-content {
  background-color: var(--theme-card) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

html[data-theme="dark"] .modal-header,
html[data-admin-theme="dark"] .modal-header {
  background-color: var(--theme-surface) !important;
  border-bottom: 1px solid var(--theme-border) !important;
}

html[data-theme="dark"] .modal-footer,
html[data-admin-theme="dark"] .modal-footer {
  background-color: var(--theme-surface) !important;
  border-top: 1px solid var(--theme-border) !important;
}

html[data-theme="dark"] .dropdown-menu,
html[data-admin-theme="dark"] .dropdown-menu {
  background-color: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

html[data-theme="dark"] .dropdown-item,
html[data-admin-theme="dark"] .dropdown-item {
  color: var(--theme-text) !important;
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-admin-theme="dark"] .dropdown-item:hover {
  background-color: var(--theme-card-hover) !important;
  color: var(--theme-heading) !important;
}

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

html[data-theme="dark"] .text-dark,
html[data-admin-theme="dark"] .text-dark,
html[data-theme="dark"] .text-gray-800,
html[data-admin-theme="dark"] .text-gray-800,
html[data-theme="dark"] .text-gray-900,
html[data-admin-theme="dark"] .text-gray-900 {
  color: var(--theme-heading) !important;
}


/* ============================================================================
   5. OPTIONAL COMPONENT UTILITIES
   ============================================================================ */

.theme-gradient {
  background: linear-gradient(135deg, #0B1425 0%, #101C35 55%, #172844 100%);
  color: #FFFFFF;
}

.theme-gold-text {
  color: var(--theme-primary);
}

.theme-gold-border {
  border-color: var(--theme-primary-border);
}

.theme-gold-glow {
  box-shadow: 0 0 0 1px var(--theme-primary-border),
              0 8px 28px var(--theme-primary-glow);
}

.theme-premium-card {
  background: var(--theme-card);
  color: var(--theme-text);
  border: 1px solid var(--theme-card-border, var(--theme-border));
  border-radius: 14px;
  box-shadow: var(--theme-shadow-sm);
  transition: background-color 180ms ease, border-color 180ms ease,
              box-shadow 180ms ease, transform 180ms ease;
}

.theme-premium-card:hover {
  background: var(--theme-card-hover);
  box-shadow: var(--theme-shadow);
}

.theme-b2b {
  --theme-b2b: #315D86;
  --theme-b2b-soft: rgba(49, 93, 134, 0.12);
}

.theme-c2c {
  --theme-c2c: var(--theme-primary);
  --theme-c2c-soft: var(--theme-primary-soft);
}


/* ============================================================================
   6. GLOBAL ACCESSIBILITY & BROWSER CHROME
   ============================================================================ */

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--theme-primary);
  outline-offset: 3px;
}

::selection {
  color: #111318;
  background: rgba(199, 25, 63, 0.22);
}

:root[data-theme="dark"] ::selection,
:root[data-admin-theme="dark"] ::selection {
  color: #FFFFFF;
  background: rgba(255, 73, 104, 0.42);
}

:where(input, select, textarea):focus {
  border-color: var(--theme-border-focus);
  box-shadow: 0 0 0 3px var(--theme-primary-soft);
}

/* Browser scrollbar — subtle, theme-aware */
* {
  scrollbar-color: var(--theme-primary-border) var(--theme-section);
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: var(--theme-section);
}

*::-webkit-scrollbar-thumb {
  background: var(--theme-primary-border);
  border: 2px solid var(--theme-section);
  border-radius: 9999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--theme-primary);
}


/* ============================================================================
   7. CENTRALIZED ICON COLOR SYSTEM
   Universal icon color token: --theme-icon-color: #FFFFFF;
   Controls all icons throughout the website:
   - Header, navigation, and mobile menu icons
   - Search, cart, account, wishlist, and notification icons
   - Homepage and product section icons
   - Product cards, badges, and product detail icons
   - Buttons, floating controls, toast, and action icons
   - Footer and contact icons
   - Customer dashboard icons
   - Admin dashboard, topbar, and sidebar icons
   - Dealer ERP and staff portal icons
   Supports Font Awesome, Bootstrap Icons, Lucide, SVG, and CSS-based icons.
   ============================================================================ */

/* Font Awesome (all variants: solid, regular, brands, light, thin, duotone, classic) */
i[class*="fa-"],
span[class*="fa-"],
.fa, .fas, .far, .fal, .fad, .fab,
.fa-solid, .fa-regular, .fa-brands, .fa-light, .fa-thin, .fa-duotone,
[class*=" fa-"],
[class^="fa-"] {
  color: var(--theme-icon-color) !important;
}

/* Bootstrap Icons */
i[class*="bi-"],
span[class*="bi-"],
.bi,
[class^="bi-"],
[class*=" bi-"] {
  color: var(--theme-icon-color) !important;
}

/* Lucide Icons */
[data-lucide],
.lucide,
svg.lucide,
i[data-lucide] {
  color: var(--theme-icon-color) !important;
  stroke: var(--theme-icon-color) !important;
}

/* SVG and Inline SVG Icons */
svg.icon,
svg.feather,
svg[class*="icon"],
svg[class*="fa-"],
svg.bi,
.icon svg,
.btn svg,
.nav-link svg,
.dropdown-item svg,
.sidebar svg,
.topbar svg,
.lx-icon-btn svg,
.admin-kpi-icon svg {
  color: var(--theme-icon-color) !important;
  fill: currentColor !important;
  stroke: currentColor !important;
}

/* Specific SVG stroke/fill handling for stroke-based icon libraries like Lucide & Feather */
svg.lucide,
svg.feather,
[data-lucide] svg,
svg[data-icon] {
  stroke: var(--theme-icon-color) !important;
}
svg.lucide[fill]:not([fill="none"]),
svg[data-icon][fill]:not([fill="none"]) {
  fill: var(--theme-icon-color) !important;
}

/* CSS-based icons */
.icon,
i.icon,
span.icon,
[class*="-icon"]:not(.admin-kpi-card):not(.card):not(.btn) {
  color: var(--theme-icon-color) !important;
}

/* Ensure overrides beat utility classes (e.g. text-primary, text-gold, text-gray, etc.) on icons */
i[class*="fa-"][class*="text-"],
i[class*="bi-"][class*="text-"],
span[class*="fa-"][class*="text-"],
span[class*="bi-"][class*="text-"],
.fa[class*="text-"],
.fas[class*="text-"],
.far[class*="text-"],
.fab[class*="text-"],
.fa-solid[class*="text-"],
.fa-regular[class*="text-"],
.fa-brands[class*="text-"],
.bi[class*="text-"] {
  color: var(--theme-icon-color) !important;
}

