/* Theme layer. Default "spa" matches the green, gold, and white palette.
   Switching data-theme retints every page that uses these tokens. */

html[data-theme="spa"] {
  --primary: #2c5f2d;
  --primary-dark: #1e3f1f;
  --primary-darker: #0f2b10;
  --primary-light: #6fbf8c;
  --primary-color: #2c5f2d;
  --primary-hover: #1e3f1f;
  --secondary: #c9a87c;
  --secondary-dark: #b8946a;
  --secondary-light: #e8d5b5;
  --secondary-color: #c9a87c;
  --secondary-hover: #b8946a;
  --accent: #c9a87c;
  --accent-color: #e8d5b5;
  --background: #f5f7f6;
  --light-bg: #f5f7f6;
  --neutral-50: #f5f7f6;
  --surface: #ffffff;
  --white: #ffffff;
  --text-dark: #1e2a2e;
  --text-medium: #4a6b68;
  --neutral-dark: #1e2a2e;
  --neutral-darker: #0f1618;
  --neutral-medium-dark: #2a3a3e;
  --border-color: #d4dcd9;
}

html[data-theme="ivory"] {
  --primary: #3e6b4a;
  --primary-dark: #2c4a34;
  --primary-darker: #1c3324;
  --primary-light: #8fbf9a;
  --primary-color: #3e6b4a;
  --primary-hover: #2c4a34;
  --secondary: #d4b483;
  --secondary-dark: #b8946a;
  --secondary-light: #f0e2c8;
  --secondary-color: #d4b483;
  --secondary-hover: #b8946a;
  --accent: #d4b483;
  --accent-color: #f0e2c8;
  --background: #fbf7f0;
  --light-bg: #fbf7f0;
  --neutral-50: #fbf7f0;
  --surface: #ffffff;
  --white: #ffffff;
  --text-dark: #3a3228;
  --text-medium: #6b5e4e;
  --neutral-dark: #3a3228;
  --neutral-darker: #2a241c;
  --neutral-medium-dark: #4a4036;
  --border-color: #e6dccb;
}

html[data-theme="forest"] {
  --primary: #1b4332;
  --primary-dark: #081c15;
  --primary-darker: #04110d;
  --primary-light: #52b788;
  --primary-color: #1b4332;
  --primary-hover: #081c15;
  --secondary: #d4a373;
  --secondary-dark: #b08968;
  --secondary-light: #edd9c0;
  --secondary-color: #d4a373;
  --secondary-hover: #b08968;
  --accent: #d4a373;
  --accent-color: #edd9c0;
  --background: #e8f0ea;
  --light-bg: #e8f0ea;
  --neutral-50: #e8f0ea;
  --surface: #ffffff;
  --white: #ffffff;
  --text-dark: #081c15;
  --text-medium: #2d6a4f;
  --neutral-dark: #1b4332;
  --neutral-darker: #081c15;
  --neutral-medium-dark: #2d6a4f;
  --border-color: #b7d4c2;
}

html[data-theme="night"] {
  --primary: #c9a87c;
  --primary-dark: #a6843a;
  --primary-darker: #6e5824;
  --primary-light: #e8d5b5;
  --primary-color: #c9a87c;
  --primary-hover: #a6843a;
  --secondary: #6fbf8c;
  --secondary-dark: #2c5f2d;
  --secondary-light: #c5e6d0;
  --secondary-color: #6fbf8c;
  --secondary-hover: #2c5f2d;
  --accent: #c9a87c;
  --accent-color: #e8d5b5;
  --background: #101614;
  --light-bg: #101614;
  --neutral-50: #1a2420;
  --surface: #1a2420;
  --white: #f5f7f6;
  --text-dark: #f5f7f6;
  --text-medium: #c5d6d2;
  --neutral-dark: #1a2420;
  --neutral-darker: #0b100e;
  --neutral-medium-dark: #24302b;
  --border-color: #3e5348;
}

html[data-theme] body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

html[data-theme] body:not(:has(.welcome-section)) {
  background: var(--background);
  color: var(--text-dark);
}

html[data-theme] .side-nav-menu-section {
  background: var(--primary-darker) !important;
  border-right-color: var(--primary) !important;
}

html[data-theme] .btn,
html[data-theme] .action-btn,
html[data-theme] .header-admin,
html[data-theme] .ecommerce-header {
  border-color: var(--secondary);
}

html[data-theme="night"] .container,
html[data-theme="night"] .auth-section,
html[data-theme="night"] .card,
html[data-theme="night"] .second-col,
html[data-theme="night"] .ecommerce-container,
html[data-theme="night"] .main-content {
  background: var(--surface) !important;
  color: var(--text-dark) !important;
}

html[data-theme="night"] input,
html[data-theme="night"] select,
html[data-theme="night"] textarea {
  background: #0f1614;
  color: var(--text-dark);
  border-color: var(--border-color);
}

#ihobiz-tools {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 100000;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 16px);
  padding: 6px;
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--text-dark, #1e2a2e);
  border: 1px solid var(--secondary, #c9a87c);
  box-shadow: 0 8px 24px rgba(15, 43, 16, 0.18);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 12px;
}

#ihobiz-net {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  padding: 4px 8px;
  cursor: pointer;
  white-space: nowrap;
}

#ihobiz-net[data-state="offline"] {
  color: #c45c4a;
}

#ihobiz-net[data-state="pending"] {
  color: #a6843a;
}

#ihobiz-net[data-state="online"] {
  color: #1f8a4c;
}

#ihobiz-theme {
  border: 1px solid var(--border-color, #d4dcd9);
  background: var(--surface, #fff);
  color: var(--text-dark, #1e2a2e);
  border-radius: 999px;
  padding: 4px 8px;
  font: inherit;
  max-width: 46vw;
}

#ihobiz-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 100000;
  max-width: calc(100vw - 24px);
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--primary-darker, #0f2b10);
  color: #fff;
  font: 13px "Segoe UI", Tahoma, sans-serif;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

html[data-theme="black-gold"] {
  --primary: #c9a87c;
  --primary-dark: #a6843a;
  --primary-darker: #0a0a0a;
  --primary-light: #e8d5b5;
  --primary-color: #c9a87c;
  --primary-hover: #e8d5b5;
  --secondary: #c9a87c;
  --secondary-dark: #8c6b3e;
  --secondary-light: #f3e6cf;
  --secondary-color: #c9a87c;
  --accent: #c9a87c;
  --accent-color: #e8d5b5;
  --background: #0a0a0a;
  --light-bg: #0a0a0a;
  --neutral-50: #141414;
  --surface: #141414;
  --white: #f6f1e7;
  --text-dark: #f3e6cf;
  --text-medium: #c9a87c;
  --neutral-dark: #141414;
  --neutral-darker: #000000;
  --neutral-medium-dark: #1c1c1c;
  --border-color: #3a3124;
}

html[data-theme="bronze"] {
  --primary: #8c5a2b;
  --primary-dark: #3b2414;
  --primary-darker: #1a120c;
  --primary-light: #d4a373;
  --primary-color: #8c5a2b;
  --primary-hover: #3b2414;
  --secondary: #c9a87c;
  --secondary-dark: #8c6b3e;
  --secondary-light: #edd9c0;
  --secondary-color: #c9a87c;
  --accent: #d4a373;
  --accent-color: #edd9c0;
  --background: #1a120c;
  --light-bg: #24180f;
  --neutral-50: #2a1c12;
  --surface: #2a1c12;
  --white: #f6efe4;
  --text-dark: #f3e6cf;
  --text-medium: #d4a373;
  --neutral-dark: #2a1c12;
  --neutral-darker: #120c08;
  --neutral-medium-dark: #3b2414;
  --border-color: #6b4a2a;
}

html[data-theme="emerald"] {
  --primary: #0f6e56;
  --primary-dark: #084c3d;
  --primary-darker: #042f27;
  --primary-light: #7dcea0;
  --primary-color: #0f6e56;
  --primary-hover: #084c3d;
  --secondary: #e6c07b;
  --secondary-dark: #b8946a;
  --secondary-light: #f4e4c4;
  --secondary-color: #e6c07b;
  --accent: #e6c07b;
  --accent-color: #f4e4c4;
  --background: #f3faf6;
  --light-bg: #f3faf6;
  --neutral-50: #f3faf6;
  --surface: #ffffff;
  --white: #ffffff;
  --text-dark: #073b30;
  --text-medium: #0f6e56;
  --neutral-dark: #084c3d;
  --neutral-darker: #042f27;
  --neutral-medium-dark: #0f6e56;
  --border-color: #c6e6d6;
}

html[data-theme] .main-header,
html[data-theme] .side-nav-menu-section,
html[data-theme] .mobile-side-menu,
html[data-theme] .mobile-menu-header {
  background: var(--primary-darker) !important;
  color: var(--secondary) !important;
  border-color: var(--secondary) !important;
}

html[data-theme] .main-header a,
html[data-theme] .main-header i,
html[data-theme] .main-header button,
html[data-theme] .side-nav-menu-section a,
html[data-theme] .side-nav-menu-section i,
html[data-theme] .side-nav a,
html[data-theme] .mobile-side-menu a,
html[data-theme] .mobile-side-menu i {
  color: var(--secondary-light) !important;
}

html[data-theme] .side-nav-menu-section .nav-text,
html[data-theme] .main-header .top-link {
  color: var(--white) !important;
}

html[data-theme="black-gold"] body,
html[data-theme="bronze"] body,
html[data-theme="night"] body:not(:has(.welcome-section)) {
  background: var(--background) !important;
  color: var(--text-dark) !important;
}

#ihobiz-tools.ihobiz-in-menu {
  position: static;
  top: auto;
  right: auto;
  z-index: 2;
  margin: 12px;
  width: calc(100% - 24px);
  max-width: none;
  flex-wrap: wrap;
  border-radius: 12px;
  background: var(--surface, #fff);
}

#ihobiz-menu-slot {
  padding-bottom: 8px;
}

html[data-theme="guinness"] {
  --background: #000000;
  --surface: #15120c;
  --text-dark: #f6d775;
  --primary: #ffdc25;
  --button-ink: #171100;
  --primary-darker: #000000;
  --secondary: #f6d775;
}

html[data-theme="fanta"] {
  --background: #004ba8;
  --surface: #003e88;
  --text-dark: #ffffff;
  --primary: #be4800;
  --button-ink: #ffffff;
  --primary-darker: #003571;
  --secondary: #ffffff;
}

html[data-theme="coca-cola"] {
  --background: #fff3f3;
  --surface: #ffffff;
  --text-dark: #411017;
  --primary: #b70b22;
  --button-ink: #ffffff;
  --primary-darker: #8c0719;
  --secondary: #ffffff;
}

html[data-theme="pepsi"] {
  --background: #eaf3ff;
  --surface: #ffffff;
  --text-dark: #092956;
  --primary: #b91232;
  --button-ink: #ffffff;
  --primary-darker: #003974;
  --secondary: #ffffff;
}

html[data-theme="spotify"] {
  --background: #121212;
  --surface: #202020;
  --text-dark: #f5fff7;
  --primary: #1ed760;
  --button-ink: #06170c;
  --primary-darker: #082416;
  --secondary: #ffffff;
}

html[data-theme="mtn"] {
  --background: #fff9df;
  --surface: #fffdf4;
  --text-dark: #241b05;
  --primary: #ffcb05;
  --button-ink: #211900;
  --primary-darker: #302604;
  --secondary: #ffdf56;
}

html[data-theme="netflix"] {
  --background: #100b0d;
  --surface: #21191c;
  --text-dark: #fff5f6;
  --primary: #bd1020;
  --button-ink: #ffffff;
  --primary-darker: #20080d;
  --secondary: #ffecef;
}

html[data-theme="ikea"] {
  --background: #edf5fc;
  --surface: #ffffff;
  --text-dark: #093956;
  --primary: #ffda1a;
  --button-ink: #152c52;
  --primary-darker: #00437c;
  --secondary: #fff29a;
}

html[data-theme="cadbury"] {
  --background: #261040;
  --surface: #3b1c58;
  --text-dark: #fff6ff;
  --primary: #e4bd78;
  --button-ink: #321643;
  --primary-darker: #2c1051;
  --secondary: #f5dcac;
}

html[data-theme="starbucks"] {
  --background: #edf6f1;
  --surface: #ffffff;
  --text-dark: #163a30;
  --primary: #006241;
  --button-ink: #ffffff;
  --primary-darker: #123b30;
  --secondary: #d4ebdf;
}

html[data-theme="dhl"] {
  --background: #fff3b0;
  --surface: #fffbe9;
  --text-dark: #482409;
  --primary: #ab1015;
  --button-ink: #ffffff;
  --primary-darker: #56210f;
  --secondary: #ffda22;
}

html[data-theme="t-mobile"] {
  --background: #fff2f8;
  --surface: #ffffff;
  --text-dark: #42122f;
  --primary: #b90063;
  --button-ink: #ffffff;
  --primary-darker: #650139;
  --secondary: #ffeaf6;
}

html[data-theme="ihobiz"] {
  --background: #007bff;
  --surface: #005bbd;
  --text-dark: #ffffff;
  --primary: #8b0000;
  --button-ink: #ffffff;
  --primary-darker: #0054ae;
  --secondary: #ffffff;
}

html[data-theme="amazon"] {
  --background: #edf2f6;
  --surface: #ffffff;
  --text-dark: #172635;
  --primary: #ffae32;
  --button-ink: #201408;
  --primary-darker: #232f3e;
  --secondary: #fff0d6;
}

html:is([data-theme="guinness"], [data-theme="fanta"], [data-theme="coca-cola"], [data-theme="pepsi"], [data-theme="spotify"], [data-theme="mtn"], [data-theme="netflix"], [data-theme="ikea"], [data-theme="cadbury"], [data-theme="starbucks"], [data-theme="dhl"], [data-theme="t-mobile"], [data-theme="amazon"], [data-theme="ihobiz"]) {
  --secondary-light: var(--secondary);
  --primary-color: var(--primary);
  --primary-dark: color-mix(in srgb, var(--primary) 85%, black);
  --primary-hover: var(--primary-dark);
  --primary-light: color-mix(in srgb, var(--primary) 65%, white);
  --secondary-dark: var(--primary-dark);
  --secondary-color: var(--secondary);
  --secondary-hover: var(--primary-dark);
  --accent: var(--primary);
  --accent-color: var(--primary);
  --light-bg: var(--background);
  --neutral-50: var(--surface);
  --neutral-dark: var(--text-dark);
  --neutral-darker: var(--primary-darker);
  --neutral-medium-dark: var(--primary-darker);
  --text-medium: color-mix(in srgb, var(--text-dark) 88%, var(--surface));
  --white: #fff;
  --border-color: color-mix(in srgb, var(--text-dark) 38%, var(--surface));
}

/* Bridge the shared palette to the older header and dashboard templates. */
html[data-theme] {
  --primary-green: var(--primary);
  --primary-green-dark: var(--primary-dark);
  --primary-green-light: var(--primary-light);
  --primary-green-50: color-mix(in srgb, var(--primary) 12%, var(--surface));
  --secondary-gold: var(--secondary);
  --secondary-gold-dark: var(--text-medium);
  --text-primary: var(--text-dark);
  --text-secondary: var(--text-medium);
  --background-light: var(--background);
  --border: var(--border-color);
}
html[data-theme] .main-header .logo + #ihobiz-theme {
  position: static;
  flex: 0 1 auto;
  width: clamp(4rem, 11vw, 10rem);
  min-width: 3.5rem;
  margin: 0;
  font: 600 12px/1.4 system-ui,sans-serif;
}
html[data-theme] :is(.mobile-admin-panel,.mobile-menu-content) {
  --green: var(--primary);
  --green-dark: var(--text-dark);
  --green-light: var(--primary-light);
  --green-50: var(--primary-green-50);
  --gold: var(--secondary);
  --gold-dark: var(--text-medium);
  --gold-light: var(--secondary-light);
  --gold-50: color-mix(in srgb, var(--secondary) 10%, var(--surface));
  --bg: var(--background);
  --white: var(--surface);
  --card-bg: var(--surface);
  --text: var(--text-dark);
  --text-muted: var(--text-medium);
  background: var(--background) !important;
}
html[data-theme] #mobileSideMenu,
html[data-theme] :is(.mobile-section,.mobile-menu-section,.main-header .dropdown-content) {
  background: var(--surface) !important;
  color: var(--text-dark) !important;
}
html[data-theme] :is(.mobile-admin-panel,.mobile-menu-content) :is(.section-title,.section-heading),
html[data-theme] .main-header .dropdown-content a,
html[data-theme] .main-header .dropdown-content i,
html[data-theme] #mobileSideMenu .mobile-menu-section a {
  background-color: var(--surface);
  color: var(--text-dark) !important;
}
html[data-theme] :is(.mobile-admin-panel,.mobile-menu-content) :is(.section-title,.section-heading) {
  background: var(--green-50);
}
html[data-theme] :is(.mobile-admin-panel,.mobile-menu-content) .nav-tile .tile-icon {
  background: var(--primary);
  color: var(--button-ink,#fff);
}
html[data-theme] #mobileSideMenu .nav-tile .tile-icon i { color: inherit !important }
html[data-theme] .main-header :is(.brand-name,.brand-sub,.top-link) { color: var(--secondary-light) !important }
html[data-theme] #mobileSideMenu .mobile-menu-section a:hover { background: var(--primary-green-50) }

html:is([data-theme="guinness"], [data-theme="fanta"], [data-theme="coca-cola"], [data-theme="pepsi"], [data-theme="spotify"], [data-theme="mtn"], [data-theme="netflix"], [data-theme="ikea"], [data-theme="cadbury"], [data-theme="starbucks"], [data-theme="dhl"], [data-theme="t-mobile"], [data-theme="amazon"], [data-theme="ihobiz"]) :is(body,.second-col,.main-content,.dashboard-container) {
  background: var(--background) !important;
  color: var(--text-dark) !important;
}
html:is([data-theme="guinness"], [data-theme="fanta"], [data-theme="coca-cola"], [data-theme="pepsi"], [data-theme="spotify"], [data-theme="mtn"], [data-theme="netflix"], [data-theme="ikea"], [data-theme="cadbury"], [data-theme="starbucks"], [data-theme="dhl"], [data-theme="t-mobile"], [data-theme="amazon"], [data-theme="ihobiz"]) :is(.card,.dashboard-header,.stat-card,.auth-section,input,textarea,select) {
  background-color: var(--surface);
  color: var(--text-dark);
  border-color: var(--border-color);
}
html:is([data-theme="guinness"], [data-theme="fanta"], [data-theme="coca-cola"], [data-theme="pepsi"], [data-theme="spotify"], [data-theme="mtn"], [data-theme="netflix"], [data-theme="ikea"], [data-theme="cadbury"], [data-theme="starbucks"], [data-theme="dhl"], [data-theme="t-mobile"], [data-theme="amazon"], [data-theme="ihobiz"]) :is(.btn-primary,.action-btn,button[type="submit"],.main-header button.top-link,.nav-grid .nav-tile,.quick-pills .quick-pill) {
  background: var(--primary) !important;
  color: var(--button-ink) !important;
}
html[data-theme] :is(.main-header button.top-link,.main-header button[type="submit"]) i,
html:is([data-theme="guinness"], [data-theme="fanta"], [data-theme="coca-cola"], [data-theme="pepsi"], [data-theme="spotify"], [data-theme="mtn"], [data-theme="netflix"], [data-theme="ikea"], [data-theme="cadbury"], [data-theme="starbucks"], [data-theme="dhl"], [data-theme="t-mobile"], [data-theme="amazon"], [data-theme="ihobiz"]) .nav-grid .nav-tile :is(.tile-title,.tile-desc) { color: var(--button-ink,inherit) !important }

/* Company identity and the full-width shortcut tray share the header palette. */
html[data-theme] #store-profile.profile-section,
html[data-theme] .bottom-action-bar,
html[data-theme] .bottom-action-bar > .action-row {
  background: var(--primary-darker) !important;
  color: var(--secondary-light);
  border-color: var(--secondary);
}
html[data-theme] #store-profile .profile-details :is(h4,p,i) {
  color: var(--secondary-light);
}
html[data-theme] #store-profile .profile-image {
  background: var(--surface);
  border-color: var(--secondary);
  box-shadow: 0 2px 8px rgb(0 0 0 / 25%);
}
html[data-theme] #store-profile #logout-link,
html[data-theme] .bottom-action-bar .action-row .action-btn {
  background: var(--primary) !important;
  color: var(--button-ink, white) !important;
  border-color: var(--secondary);
}
html[data-theme="night"], html[data-theme="black-gold"] { --button-ink: #1e180d }
html[data-theme] .bottom-action-bar .action-btn .icon-wrapper {
  background: var(--primary-darker);
  box-shadow: none;
}
html[data-theme] .bottom-action-bar .icon-wrapper i { color: var(--secondary-light) }
html[data-theme] .bottom-action-bar .action-btn span { text-shadow: none }
html[data-theme] .bottom-action-bar :is(.bar-highlight,.active-indicator) { background: var(--secondary) }

/* Brand themes only set a few tokens. Quick Sales reads the rest, so fill them
   from the theme or the page stays green beside a red, gold, or black header. */
html:is([data-theme="guinness"], [data-theme="fanta"], [data-theme="coca-cola"], [data-theme="pepsi"], [data-theme="spotify"], [data-theme="mtn"], [data-theme="netflix"], [data-theme="ikea"], [data-theme="cadbury"], [data-theme="starbucks"], [data-theme="dhl"], [data-theme="t-mobile"], [data-theme="amazon"], [data-theme="ihobiz"]) {
  --primary-dark: color-mix(in srgb, var(--primary) 72%, black);
  --primary-light: color-mix(in srgb, var(--primary) 45%, white);
  --primary-50: color-mix(in srgb, var(--background) 78%, white);
  --secondary-dark: color-mix(in srgb, var(--secondary) 70%, black);
  --secondary-light: color-mix(in srgb, var(--secondary) 78%, white);
  --neutral-dark: var(--primary-darker);
  --neutral-darker: var(--primary-darker);
  --neutral-medium-dark: var(--surface);
  --neutral-medium: color-mix(in srgb, var(--text-dark) 55%, var(--background));
  --neutral-light: color-mix(in srgb, var(--text-dark) 28%, var(--background));
  --neutral-lighter: color-mix(in srgb, var(--background) 65%, white);
  --neutral-50: var(--background);
  --success: var(--primary);
  --warning: var(--secondary);
  --info: var(--primary);
  --border-color: color-mix(in srgb, var(--primary) 32%, var(--background));
  --text-medium: color-mix(in srgb, var(--text-dark) 78%, var(--background));
  --white: #fff;
}

html[data-theme] .ecommerce-container,
html[data-theme] .products-section,
html[data-theme] .products-main,
html[data-theme] .cart-panel,
html[data-theme] .order-summary,
html[data-theme] .categories-sidebar {
  background: var(--background);
  color: var(--text-dark);
}
html[data-theme] .products-section,
html[data-theme] .product-card,
html[data-theme] .category-item,
html[data-theme] .mobile-category-item {
  background: var(--surface);
  color: var(--text-dark);
  border-color: var(--border-color);
}
html[data-theme] .ecommerce-header,
html[data-theme] .sidebar-header,
html[data-theme] .categories-sidebar .sidebar-header {
  background: linear-gradient(135deg, var(--neutral-darker), var(--primary-dark)) !important;
  color: var(--white, #fff);
}
html[data-theme] .category-item.active,
html[data-theme] .mobile-category-item.active,
html[data-theme] .add-to-cart-btn,
html[data-theme] .checkout-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
  color: var(--button-ink, #fff) !important;
}
html[data-theme] .add-to-cart-btn:hover:not(:disabled),
html[data-theme] .checkout-btn:hover:not(:disabled) {
  background: var(--primary-dark) !important;
}

