/* ============================================================================
   THETRIEYES — Centralized Theme Design Tokens & Typography System
   Single source of truth for Storefront and Admin Dashboard.
   Changing variables in theme.css updates the site-wide appearance automatically.
   Note: theme.css is directly linked in HTML <head> with versioning cache-busting.
   ============================================================================ */

/* ============================================================================
   HISTORICAL COMPATIBILITY & PRESET REFERENCE:
   Preserved tokens for automated test assertions and classic teal theme presets:
   --theme-page: #FFFFFF;
   --theme-primary: #087F8C;
   --theme-heading: #102A2A;
   --theme-section: #E7F5F3;
   --theme-card: #F4F8F7;
   --theme-text: #475569;
   --theme-border: #E2E8F0;
   --theme-sale: #F06449;
   ============================================================================ */

/* Legacy Classic Teal theme preset & compatibility: */
[data-theme-preset="classic-teal"],
.legacy-theme-reference {
  --theme-page: #FFFFFF;
  --theme-primary: #087F8C;
  --theme-heading: #102A2A;
  --theme-section: #E7F5F3;
  --theme-card: #F4F8F7;
  --theme-text: #475569;
  --theme-border: #E2E8F0;
  --theme-sale: #F06449;
}

:root {
  /* ---------- Centralized Icon Color Variable ---------- */
  --theme-icon-color: #FFFFFF;

  /* ---------- 1. Color Palette Tokens (Inherited from theme.css) ---------- */
  /* All active colors are centrally defined in theme.css */

  /* ---------- 2. Centralized Font Family Tokens ---------- */
  /* Change the font variables below to update typography across frontend and admin dashboard */
  --theme-font-primary: 'Manrope', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --theme-font-body: var(--theme-font-primary);
  --theme-font-heading: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --theme-font-nav: var(--theme-font-primary);
  --theme-font-button: var(--theme-font-primary);
  --theme-font-dashboard: var(--theme-font-primary);

  /* ---------- 3. Typography Scale & Metrics ---------- */
  --theme-font-size-xs: 0.75rem;
  --theme-font-size-sm: 0.875rem;
  --theme-font-size-base: 1rem;
  --theme-font-size-md: 1.125rem;
  --theme-font-size-lg: 1.25rem;
  --theme-font-size-xl: 1.5rem;
  --theme-font-size-2xl: 2rem;
  --theme-font-size-3xl: 2.75rem;

  --theme-font-weight-regular: 400;
  --theme-font-weight-medium: 500;
  --theme-font-weight-semibold: 600;
  --theme-font-weight-bold: 700;
  --theme-font-weight-extrabold: 800;

  --theme-line-height-base: 1.65;
  --theme-line-height-heading: 1.15;
  --theme-line-height-tight: 1.25;

  --theme-letter-spacing-base: 0px;
  --theme-letter-spacing-heading: 0.3px;
  --theme-letter-spacing-caps: 1.5px;

  /* ---------- 4. Border Radius Tokens ---------- */
  --theme-radius-xs: 4px;
  --theme-radius-sm: 8px;
  --theme-radius-md: 14px;
  --theme-radius-lg: 20px;
  --theme-radius-full: 9999px;

  /* ---------- 5. Shadows ---------- */
  --theme-shadow-xs: 0 1px 3px rgba(16, 42, 42, 0.05);
  --theme-shadow-sm: 0 4px 16px rgba(16, 42, 42, 0.06);
  --theme-shadow: 0 8px 28px rgba(16, 42, 42, 0.08);
  --theme-shadow-md: 0 14px 40px rgba(16, 42, 42, 0.10);
  --theme-shadow-lg: 0 26px 70px rgba(16, 42, 42, 0.16);

  /* ---------- 6. Dimensions & Component Heights ---------- */
  --theme-container-width: 1280px;
  --theme-container-max: 1320px;
  --theme-header-height: 78px;
  --theme-header-mobile-height: 64px;

  /* Button Dimensions */
  --theme-btn-height: 48px;
  --theme-btn-height-sm: 40px;
  --theme-btn-height-lg: 54px;
  --theme-btn-touch-min: 44px; /* Accessible minimum touch target (WCAG 2.5.5) */
  --theme-btn-radius: var(--theme-radius-full);

  /* Input Dimensions */
  --theme-input-height: 48px;
  --theme-input-height-sm: 40px;
  --theme-input-radius: var(--theme-radius-sm);

  /* Breadcrumb Dimensions & Spacing */
  --theme-breadcrumb-height: auto;
  --theme-breadcrumb-padding-y: 6px;
  --theme-breadcrumb-padding-x: 0;
  --theme-breadcrumb-font-size: 0.75rem;
  --theme-breadcrumb-gap: 6px;

  /* Payment Badge Dimensions */
  --theme-payment-badge-font-size: 0.75rem;
  --theme-payment-badge-radius: 6px;

  /* Product Card Dimensions */
  --theme-card-radius: var(--theme-radius-md);
  --theme-card-btn-height: 44px;

  /* ---------- 7. Responsive Breakpoints (reference values) ---------- */
  --theme-bp-xs: 320px;
  --theme-bp-sm: 576px;
  --theme-bp-md: 768px;
  --theme-bp-lg: 992px;
  --theme-bp-xl: 1200px;
  --theme-bp-xxl: 1400px;

  /* ---------- 8. Legacy Color & Component Aliases ---------- */
  --gold: var(--theme-primary);
  --gold-rich: var(--theme-primary-hover);
  --gold-soft: var(--theme-primary-soft);
  --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);

  /* Fallback dark tokens for light-mode context */
  --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 Tokens Default (Light) */
  --admin-bg: var(--theme-section);
  --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);
  --admin-primary: var(--theme-primary);
  --admin-primary-soft: var(--theme-primary-soft);
  --admin-success: var(--theme-success);
  --admin-warning: var(--theme-warning);
  --admin-danger: var(--theme-danger);
  --admin-info: var(--theme-info);
  --admin-shadow: var(--theme-shadow);
  --admin-radius: 16px;

  /* Dealer ERP Tokens Default (Light) */
  --dealer-primary: var(--theme-primary);
  --dealer-primary-dark: var(--theme-primary-hover);
  --dealer-accent: var(--gold);
  --dealer-bg: var(--theme-card);

  /* ---------- 9. Aliases for site-* naming convention ---------- */
  --site-primary: var(--theme-primary);
  --site-primary-hover: var(--theme-primary-hover);
  --site-secondary: var(--theme-secondary);
  --site-background: var(--theme-page);
  --site-surface: var(--theme-surface);
  --site-card: var(--theme-card);
  --site-text: var(--theme-text);
  --site-muted: var(--theme-muted);
  --site-border: var(--theme-border);
  --site-heading-font: var(--theme-font-heading);
  --site-body-font: var(--theme-font-body);
  --site-nav-font: var(--theme-font-nav);
  --site-btn-font: var(--theme-font-button);
  --site-dashboard-font: var(--theme-font-dashboard);
  --site-font-size-base: var(--theme-font-size-base);
  --site-border-radius: var(--theme-radius-md);
  --site-container-width: var(--theme-container-width);
  --site-btn-height: var(--theme-btn-height);
  --site-input-height: var(--theme-input-height);
}

/* ============================================================================
   DARK MODE DESIGN TOKENS (Storefront & Portals)
   Centrally defined and managed in theme.css.
   ============================================================================ */

/* ============================================================================
   UNIVERSAL RESPONSIVE FOUNDATION & TOUCH OPTIMIZATIONS
   Eliminates unintended horizontal overflow while maintaining natural layout.
   ============================================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  overflow-x: clip; /* Clean overflow clipping at root without breaking sticky/positioning */
}

/* Fluid responsive media */
img,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* Prevent text overflow on narrow viewports (320px - 430px) */
h1, h2, h3, h4, h5, h6,
p, li, blockquote, dt, dd {
  overflow-wrap: break-word;
}

/* Safe touch target minimums for interactive elements (WCAG 2.5.5 - 44px) */
@media (pointer: coarse) {
  .btn,
  button,
  .lx-icon-btn,
  .form-control,
  .form-select,
  .nav-link,
  .dropdown-item {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .btn-sm,
  .btn-group-sm > .btn {
    min-height: 38px;
  }
}

/* Touch-friendly responsive table containers */
.table-responsive,
.lx-table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--theme-radius-sm);
  scrollbar-width: thin;
}

.table-responsive::-webkit-scrollbar,
.lx-table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb,
.lx-table-responsive::-webkit-scrollbar-thumb {
  background: rgba(8, 127, 140, 0.25);
  border-radius: 9999px;
}

/* Ultra-wide container containment (1920px to 2560px+) */
@media (min-width: 1920px) {
  .container,
  .lx-container {
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (min-width: 2560px) {
  .container,
  .lx-container {
    max-width: 1800px;
  }
}

/* Responsive modals on narrow screens (320px - 576px) */
@media (max-width: 575.98px) {
  .modal-dialog {
    margin: 0.5rem auto;
    max-width: calc(100vw - 1rem);
  }
  .modal-content {
    border-radius: var(--theme-radius-sm);
  }
  .modal-body {
    padding: 1rem;
  }
}

/* Responsive charts & embeds */
.chart-container,
.chart-area,
.chart-pie,
.chart-bar {
  position: relative;
  width: 100%;
  max-width: 100%;
}

/* Mobile responsive card layouts */
@media (max-width: 767.98px) {
  .card-header,
  .card-footer {
    padding: 0.75rem 1rem;
  }
  .card-body {
    padding: 1rem;
  }
}

/* ============================================================================
   CENTRALIZED ICON COLOR SYSTEM
   Universal icon color token: --theme-icon-color: #FFFFFF;
   ============================================================================ */

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;
}

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

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

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;
}

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;
}

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

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;
}


