/* ==========================================================================
   Revup storefront - dark theme
   Active only under html[data-theme="dark"] (set by src/lib/theme.tsx and the
   inline script in index.html). Loaded after zz-overrides.css.

   How it works: zz-overrides.css is written against the --rv-* variables, so
   the theme is mostly a re-definition of them. Two groups of surfaces need the
   original light values back and are re-scoped below:
     1. Brand-yellow areas (header, footer band, chips, active buttons) keep
        dark text on yellow, exactly like the light theme.
     2. Floating panels inside those areas (dropdowns, mobile drawer) are dark.
   ========================================================================== */

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

  --rv-yellow-dark: #f0c400;
  --rv-yellow-ink: #f5cf2e; /* link hover / accent text: brighter on dark */
  --rv-dark: #e6e8eb; /* headings */
  --rv-ink: #f3f4f6;
  --rv-body: #aab0b7;
  --rv-muted: #7f868e;
  --rv-border: #2c3138;
  --rv-soft: #1b1e23;
  --rv-surface: #15181c;
  --rv-solid: #2a2f36;
  --rv-solid-2: #353b43;
  --rv-scroll-thumb: #454c55;
  --rv-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  --rv-shadow-sm: 0 3px 12px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] body {
  background: #0f1114;
  color: var(--rv-body);
}

/* ------- Brand-yellow areas: light palette, as in the light theme --------- */
html[data-theme="dark"]
  :is(
    .rv-topbar,
    .rv-header-main,
    .rv-footer-top,
    .rv-drawer-head,
    .rv-btn-primary,
    .btn.rv-btn-primary,
    .rv-btn-dark:hover,
    .btn.rv-btn-dark:hover,
    .rv-badge,
    .rv-cart-count,
    .rv-tabs-nav button.is-active,
    .rv-tabs-nav button:hover,
    .label_sale,
    .item-inner .action-links button:hover,
    .item-inner .action-links button.btn-wishlist.is-active,
    .item-inner .caption .inner .btn-cart:hover,
    .rv-blog-date,
    .rv-pagination button.is-active,
    .rv-product-origin li > i,
    .rv-product-origin-link:hover,
    .rv-product-origin-link:focus-visible,
    .rv-active-filter,
    .rv-wish.is-active,
    .rv-product-share a:hover,
    .rv-qty-btn:hover,
    .rv-qv-wishlist.is-active,
    .rv-tag:hover,
    .rv-accordion-item.is-open .rv-accordion-head,
    .rv-account-nav button.is-active,
    .rv-garage-selected-badge,
    .rv-back-to-top:hover,
    .rv-vp-icon,
    .rv-vbar-form button[type="submit"],
    .rv-vg-badge,
    .rv-vg-scan,
    .item-inner .caption-top .manufacture-product a,
    .rv-qv-vendor strong,
    .rv-dept-list a .rv-dept-icon
  ) {
  color-scheme: light;
  --rv-dark: #3e444a;
  --rv-ink: #242424;
  --rv-body: #6b7178;
  --rv-muted: #9aa0a6;
  --rv-border: #e6e8eb;
  --rv-soft: #f6f7f9;
  --rv-surface: #fff;
  --rv-yellow-ink: #b58900;
  --rv-shadow: 0 8px 30px rgba(20, 21, 27, 0.1);
  --rv-shadow-sm: 0 3px 12px rgba(20, 21, 27, 0.08);
}

/* Yellow bands that rely on inherited text colour */
html[data-theme="dark"] .rv-drawer-head {
  color: #242424;
}

/* ------- Floating panels: dark again, even when nested in a yellow area ---- */
html[data-theme="dark"] :is(.rv-dropdown, .rv-drawer) {
  color-scheme: dark;
  --rv-dark: #e6e8eb;
  --rv-ink: #f3f4f6;
  --rv-body: #aab0b7;
  --rv-muted: #7f868e;
  --rv-border: #2c3138;
  --rv-soft: #1b1e23;
  --rv-surface: #15181c;
  --rv-scroll-thumb: #454c55;
  --rv-yellow-ink: #f5cf2e;
  --rv-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  --rv-shadow-sm: 0 3px 12px rgba(0, 0, 0, 0.45);
}

/* ------- Hard-coded colours in zz-overrides.css --------------------------- */
html[data-theme="dark"] .rv-dropdown li a,
html[data-theme="dark"] .rv-dropdown li button {
  color: var(--rv-body);
}
html[data-theme="dark"] .rv-dropdown li a:hover,
html[data-theme="dark"] .rv-dropdown li button:hover {
  color: var(--rv-yellow-ink);
}

/* Image overlays that fade a photo into a light page */
html[data-theme="dark"] .rv-adbanner-card:before {
  background: linear-gradient(90deg, rgba(15, 17, 20, 0.92), rgba(15, 17, 20, 0.25));
}
html[data-theme="dark"] .rv-collection-hero:before {
  background: linear-gradient(90deg, rgba(15, 17, 20, 0.94), rgba(15, 17, 20, 0.55));
}
/* Pastel status / notice boxes -> translucent tints that sit on dark */
html[data-theme="dark"] .rv-contact-success,
html[data-theme="dark"] .rv-status-delivered,
html[data-theme="dark"] .rv-auth-success,
html[data-theme="dark"] .rv-order-status-delivered {
  background: rgba(39, 174, 96, 0.16);
  border-color: rgba(39, 174, 96, 0.4);
  color: #5fd18a;
}
html[data-theme="dark"] .rv-status-shipped,
html[data-theme="dark"] .rv-order-status-readyforpickup,
html[data-theme="dark"] .rv-order-status-waitingforcourier {
  background: rgba(47, 111, 219, 0.2);
  color: #8db4f5;
}
html[data-theme="dark"] .rv-status-processing,
html[data-theme="dark"] .rv-order-status {
  background: rgba(240, 196, 0, 0.16);
  color: #f5cf2e;
}
html[data-theme="dark"] .rv-order-status-assigned,
html[data-theme="dark"] .rv-order-status-pickup,
html[data-theme="dark"] .rv-order-status-ontheway {
  background: rgba(124, 92, 220, 0.22);
  color: #b9a6f2;
}
html[data-theme="dark"] .rv-auth-error,
html[data-theme="dark"] .rv-vd-error,
html[data-theme="dark"] .rv-vg-sign.is-warn,
html[data-theme="dark"] .rv-order-status-cancelled,
html[data-theme="dark"] .rv-order-status-deliveryfailed {
  background: rgba(228, 87, 61, 0.16);
  border-color: rgba(228, 87, 61, 0.4);
  color: #f08a78;
}
html[data-theme="dark"] .rv-vd-crumb.is-brand {
  background: rgba(240, 196, 0, 0.14);
  border-color: rgba(240, 196, 0, 0.35);
}

/* ------- Theme switcher --------------------------------------------------- */
.rv-theme-switcher .rv-dropdown li button i {
  width: 16px;
  margin-right: 4px;
  text-align: center;
}

/* ------- Form controls ---------------------------------------------------- */
html[data-theme="dark"]
  :is(input:not([type="checkbox"], [type="radio"], [type="range"], .rv-search-input), select, textarea) {
  background-color: var(--rv-soft);
  color: var(--rv-ink);
  border-color: var(--rv-border);
}
html[data-theme="dark"] ::placeholder {
  color: var(--rv-muted);
  opacity: 1;
}
/* Keep the header search (white on yellow) readable */
html[data-theme="dark"] .rv-search-input {
  background-color: transparent;
  color: #242424;
}
html[data-theme="dark"] .rv-search-input::placeholder {
  color: #9aa0a6;
}

/* The footer logo is black-on-transparent: flip it to white on the dark footer */
html[data-theme="dark"] .rv-logo--footer img {
  filter: brightness(0) invert(1);
}

/* Borders hard-coded in the ported theme stylesheet */
html[data-theme="dark"] .item-inner {
  border-color: var(--rv-border);
}
