/* ==========================================================================
   EliteSMM V2026 — Design System
   --------------------------------------------------------------------------
   Scoped to the theme's EXISTING body.light / body.dark switch so it
   cooperates with toggle_light_mode() and localStorage.lightMode.
   Layered over Bootstrap 4.6.1 + Select2. Adds NO new theme mechanism.
   All new classes are namespaced `es-` to avoid colliding with the
   platform's existing classes, IDs, and the service-detail engine hooks.
   ========================================================================== */

/* ---- Design tokens -------------------------------------------------------
   Defined on :root, themed by overriding under body.light / body.dark.     */
:root {
  --es-font-sans: "Plus Jakarta Sans", "Open Sans", system-ui, -apple-system,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* brand (shared across themes) */
  --es-brand: #534ab7;
  --es-brand-700: #3c3489;
  --es-brand-900: #26215c;
  --es-brand-300: #afa9ec;
  --es-brand-100: #eeedfe;
  --es-mint: #9fe1cb;
  --es-mint-600: #1d9e75;

  /* radii / shadow / spacing */
  --es-r-sm: 9px;
  --es-r-md: 12px;
  --es-r-lg: 16px;
  --es-r-pill: 999px;
  --es-gap: 16px;
  --es-shadow: 0 1px 2px rgba(16, 16, 40, 0.04),
    0 8px 24px rgba(16, 16, 40, 0.06);
  --es-shadow-pop: 0 12px 40px rgba(16, 16, 40, 0.18);

  /* tag palette (shared) */
  --es-t-pop-bg: #faeeda; --es-t-pop-fg: #854f0b;
  --es-t-fast-bg: #e6f1fb; --es-t-fast-fg: #185fa5;
  --es-t-ref-bg: #e1f5ee; --es-t-ref-fg: #0f6e56;
  --es-t-prem-bg: #eeedfe; --es-t-prem-fg: #534ab7;
}

/* LIGHT (new default first-load; see layout.twig) */
body.light {
  --es-bg: #f5f6fb;
  --es-surface: #ffffff;
  --es-surface-2: #f4f4f9;
  --es-border: #e8e8f0;
  --es-border-2: #d8d8e6;
  --es-text: #1a1726;
  --es-text-2: #5a5670;
  --es-text-3: #8b87a0;
  --es-hero-fg: #ffffff;
}

/* DARK */
body.dark {
  --es-bg: #15121f;
  --es-surface: #1f1b2e;
  --es-surface-2: #15121f;
  --es-border: #2e2a40;
  --es-border-2: #3c3658;
  --es-text: #e8e6f0;
  --es-text-2: #b9b5c9;
  --es-text-3: #79748c;
  --es-hero-fg: #ffffff;
  --es-t-pop-bg: #4a3208; --es-t-pop-fg: #fac775;
  --es-t-fast-bg: #103458; --es-t-fast-fg: #85b7eb;
  --es-t-ref-bg: #0f3d32; --es-t-ref-fg: #5dcaa5;
  --es-t-prem-bg: #2b2660; --es-t-prem-fg: #cecbf6;
}

/* ---- Primitives ---------------------------------------------------------- */
.es-card {
  background: var(--es-surface);
  border: 1px solid var(--es-border);
  border-radius: var(--es-r-lg);
  box-shadow: var(--es-shadow);
}
.es-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--es-text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  display: block;
}
.es-muted { color: var(--es-text-2); }

/* ---- Hero ---------------------------------------------------------------- */
.es-hero {
  background: linear-gradient(135deg, var(--es-brand-900), var(--es-brand-700));
  border-radius: var(--es-r-lg);
  padding: 22px 24px;
  color: var(--es-hero-fg);
  position: relative;
  overflow: hidden;
}
.es-hero::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: var(--es-brand);
  opacity: 0.35;
}
.es-hero-grid {
  position: relative; z-index: 2;
  display: flex; gap: 20px; flex-wrap: wrap;
  justify-content: space-between; align-items: flex-start;
}
.es-hero-welcome { font-size: 13px; color: var(--es-brand-300); }
.es-hero-name { font-size: 19px; font-weight: 600; margin-bottom: 16px; }
.es-metrics { display: flex; gap: 30px; flex-wrap: wrap; }
.es-metric .es-metric-l {
  font-size: 11px; color: var(--es-brand-300);
  letter-spacing: 0.04em; margin-bottom: 3px;
}
.es-metric .es-metric-v { font-size: 22px; font-weight: 600; color: #fff; }

/* ---- Level card (inside hero on desktop, inline chip on mobile) ---------- */
.es-level {
  width: 220px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--es-r-md);
  padding: 14px;
  cursor: pointer;
}
.es-level-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.es-level-badge {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--es-brand); display: flex;
  align-items: center; justify-content: center;
  transform: rotate(45deg); flex: none;
}
.es-level-badge span {
  transform: rotate(-45deg); font-size: 13px; font-weight: 600; color: #fff;
}
.es-level-cap { font-size: 10px; color: var(--es-brand-300); }
.es-level-name { font-size: 15px; font-weight: 600; color: #fff; }
.es-progress-track {
  height: 7px; background: rgba(255, 255, 255, 0.15);
  border-radius: var(--es-r-pill); overflow: hidden; margin: 8px 0 5px;
}
.es-progress-fill {
  height: 100%; width: 0%; background: var(--es-mint);
  border-radius: var(--es-r-pill); transition: width 0.6s ease;
}
.es-level-delta { font-size: 10px; color: #cecbf6; }

/* ---- Platform filter chips ----------------------------------------------- */
.es-chips {
  display: flex; gap: 7px; flex-wrap: wrap; align-items: center;
}
.es-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--es-r-pill);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--es-border);
  background: var(--es-surface); color: var(--es-text-2);
  cursor: pointer; white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.es-chip:hover { border-color: var(--es-border-2); }
.es-chip.es-on {
  background: var(--es-brand-900); color: #fff; border-color: var(--es-brand-900);
}
.es-chip i, .es-chip svg { font-size: 15px; }

/* ---- Tags ---------------------------------------------------------------- */
.es-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 9px; border-radius: 7px; font-size: 11px; font-weight: 600;
}
.es-tag.t-pop { background: var(--es-t-pop-bg); color: var(--es-t-pop-fg); }
.es-tag.t-fast { background: var(--es-t-fast-bg); color: var(--es-t-fast-fg); }
.es-tag.t-ref { background: var(--es-t-ref-bg); color: var(--es-t-ref-fg); }
.es-tag.t-prem { background: var(--es-t-prem-bg); color: var(--es-t-prem-fg); }

/* ---- Favourites ---------------------------------------------------------- */
.es-fav-row { display: flex; gap: 8px; flex-wrap: wrap; }
.es-fav {
  flex: 1; min-width: 150px;
  border: 1px solid var(--es-border); border-radius: var(--es-r-md);
  padding: 11px 13px; cursor: pointer; background: var(--es-surface);
  transition: border-color 0.15s;
}
.es-fav:hover { border-color: var(--es-brand-300); }
.es-fav-name { font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--es-text); }
/* The whole section is hidden by default; JS reveals only if favourites exist */
#es-favourites { display: none; }

/* ---- Service detail metric boxes (wraps EXISTING data-id spans) ---------- */
.es-metric-boxes { display: flex; gap: 8px; margin: 4px 0 14px; flex-wrap: wrap; }
.es-metric-box {
  flex: 1; min-width: 96px;
  background: var(--es-surface-2);
  border-radius: var(--es-r-md); padding: 13px 14px; text-align: center;
}
.es-metric-box i { font-size: 18px; color: var(--es-brand); margin-bottom: 4px; display: block; }
.es-metric-box .es-mb-l { font-size: 11px; color: var(--es-text-2); margin-bottom: 2px; }
.es-metric-box .es-mb-v { font-size: 15px; font-weight: 600; color: var(--es-text); word-break: break-word; }
/* Average Time — the highlighted, always-prominent box */
.es-metric-box.es-avg { background: var(--es-brand-100); }
body.dark .es-metric-box.es-avg { background: var(--es-brand-900); }
.es-metric-box.es-avg i,
.es-metric-box.es-avg .es-mb-l,
.es-metric-box.es-avg .es-mb-v { color: var(--es-brand); }
body.dark .es-metric-box.es-avg i { color: var(--es-mint); }
body.dark .es-metric-box.es-avg .es-mb-l { color: #cecbf6; }
body.dark .es-metric-box.es-avg .es-mb-v { color: #fff; }

/* Info rows for ID / min / max / start / link */
.es-info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--es-border); font-size: 13px;
  gap: 10px;
}
.es-info-row:last-child { border-bottom: none; }
.es-info-row .es-info-k { color: var(--es-text-2); }
.es-info-row .es-info-v { font-weight: 600; color: var(--es-text); text-align: right; word-break: break-word; }

/* Copy ID button */
.es-copy {
  border: 1px solid var(--es-border); background: var(--es-surface);
  color: var(--es-text-2); border-radius: 7px; padding: 2px 8px;
  font-size: 11px; cursor: pointer; margin-left: 6px;
}
.es-copy:hover { border-color: var(--es-brand-300); color: var(--es-brand); }

/* Collapse rows whose parsed value is empty or just a dash.
   The engine writes "-" into empty data-id spans; JS adds .es-empty. */
.es-detail-hideable.es-empty { display: none !important; }

/* Description expand / collapse wrapper around data-id="serviceDesc" */
.es-desc-wrap { position: relative; }
.es-desc-body {
  font-size: 13px; color: var(--es-text-2); line-height: 1.65;
  max-height: 92px; overflow: hidden; transition: max-height 0.3s ease;
}
.es-desc-wrap.es-expanded .es-desc-body { max-height: 1200px; }
.es-desc-toggle {
  margin-top: 6px; background: none; border: none; padding: 0;
  color: var(--es-brand); font-size: 12px; font-weight: 600; cursor: pointer;
}
.es-desc-fade {
  position: absolute; left: 0; right: 0; bottom: 28px; height: 38px;
  background: linear-gradient(to bottom, transparent, var(--es-surface));
  pointer-events: none;
}
.es-desc-wrap.es-expanded .es-desc-fade { display: none; }

/* ---- Charge highlight ---------------------------------------------------- */
.es-charge {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 15px; background: var(--es-brand-100);
  border-radius: var(--es-r-md); margin-bottom: 14px;
}
body.dark .es-charge { background: var(--es-brand-900); }
.es-charge-l { font-size: 13px; color: var(--es-brand-700); }
body.dark .es-charge-l { color: #cecbf6; }
.es-charge-v { font-size: 21px; font-weight: 700; color: var(--es-brand-900); }
body.dark .es-charge-v { color: #fff; }

/* ---- Notification bell + dropdown ---------------------------------------- */
.es-bell { position: relative; display: inline-block; }
.es-bell-btn {
  background: none; border: none; cursor: pointer;
  color: var(--es-text-2); font-size: 18px; line-height: 1;
  padding: 8px; border-radius: var(--es-r-sm);
}
.es-bell-btn:hover { background: var(--es-surface-2); color: var(--es-text); }
.es-bell-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 320px; max-width: calc(100vw - 24px);
  background: var(--es-surface); border: 1px solid var(--es-border);
  border-radius: var(--es-r-md); box-shadow: var(--es-shadow-pop);
  padding: 10px; z-index: 1080; display: none;
}
.es-bell-panel.es-open { display: block; }
.es-bell-title {
  font-size: 12px; font-weight: 700; color: var(--es-text);
  padding: 4px 6px 10px;
}
.es-announce {
  border: 1px solid var(--es-border); border-radius: var(--es-r-sm);
  padding: 11px 12px; margin-bottom: 8px; background: var(--es-surface-2);
}
.es-announce:last-child { margin-bottom: 0; }
.es-announce-h { font-size: 13px; font-weight: 600; color: var(--es-text); margin-bottom: 3px; }
.es-announce-b { font-size: 12px; color: var(--es-text-2); line-height: 1.5; }
.es-bell-empty { font-size: 12px; color: var(--es-text-3); padding: 12px 6px; text-align: center; }

/* ---- Sticky mobile order bar --------------------------------------------- */
.es-sticky-bar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1070;
  background: var(--es-surface); border-top: 1px solid var(--es-border);
  box-shadow: 0 -6px 24px rgba(16, 16, 40, 0.10);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  align-items: center; justify-content: space-between; gap: 12px;
}
.es-sticky-l .es-sticky-k { font-size: 10px; color: var(--es-text-2); }
.es-sticky-l .es-sticky-v { font-size: 17px; font-weight: 700; color: var(--es-text); }
.es-sticky-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 20px; background: var(--es-brand); color: #fff;
  border: none; border-radius: var(--es-r-md);
  font-size: 14px; font-weight: 600; cursor: pointer;
}

/* ---- Header controls cluster --------------------------------------------- */
.es-header-controls { display: flex; align-items: center; gap: 10px; }

/* ---- Accessibility / motion ---------------------------------------------- */
.es-chip:focus-visible, .es-copy:focus-visible, .es-bell-btn:focus-visible,
.es-sticky-btn:focus-visible, .es-desc-toggle:focus-visible, .es-fav:focus-visible {
  outline: 2px solid var(--es-brand); outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .es-progress-fill, .es-desc-body { transition: none; }
}

/* ==========================================================================
   Responsive — desktop two-column / mobile single-column + sticky bar
   ========================================================================== */
@media (min-width: 992px) {
  .es-only-mobile { display: none !important; }
}
@media (max-width: 991px) {
  .es-only-desktop { display: none !important; }
  .es-level { width: 100%; }
  /* Sticky bar visible on mobile; pad page bottom so it never covers submit */
  .es-sticky-bar { display: flex; }
  .site-content, .es-page { padding-bottom: 90px; }
  .es-metrics { gap: 18px; }
  .es-metric .es-metric-v { font-size: 18px; }

  /* Mobile inline details: the detail column (.col-lg-6.col-12 holding the
     service tabs) stacks directly under the form column. Tighten the gap so
     it reads as inline below the service selection, and de-emphasize the
     in-form charge block since the sticky bar now owns Total + Order. */
  .es-page .row > .col-lg-6.col-12 { margin-bottom: 14px; }
  .es-page .row > .col-lg-6.col-12:last-child { margin-bottom: 0; }
  /* The form's own price block is redundant on mobile (sticky bar mirrors it). */
  #order-form .form-group.mb-4 .input-group { opacity: 0.9; }
}
