/* ============== CUSTOMIZE PANEL ============== */
/* Shared across all dev.mystores.ru pages + created sites */

/* Floating button to open the panel */
.cust-trigger {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 998;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--ms-brand-gradient, linear-gradient(135deg, #9333ea, #a855f7));
  color: #fff;
  border: 0;
  cursor: pointer;
  box-shadow: 0 10px 28px -6px rgba(147, 51, 234, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.cust-trigger:hover { transform: translateY(-2px) rotate(15deg); box-shadow: 0 14px 32px -6px rgba(147, 51, 234, 0.6); }
.cust-trigger svg { width: 24px; height: 24px; }
.cust-trigger--hidden { display: none; }

/* Slide-out panel */
.cust-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 100vw;
  background: var(--bg-elevated, #fff);
  z-index: 999;
  box-shadow: -8px 0 32px -8px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans, 'DM Sans', sans-serif);
}
.cust-panel--open { transform: translateX(0); }
@media (max-width: 480px) { .cust-panel { width: 100vw; } }

/* Panel header */
.cust-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  background: linear-gradient(135deg, var(--ms-brand, #9333ea), var(--ms-brand-deep, #7e22ce));
  color: #fff;
  flex-shrink: 0;
}
.cust-panel__title {
  font-family: var(--font-display, 'Plus Jakarta Sans', sans-serif);
  font-weight: 800;
  font-size: 18px;
  margin: 0;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cust-panel__title svg { width: 22px; height: 22px; }
.cust-panel__close {
  background: rgba(255, 255, 255, 0.18);
  border: 0;
  color: #fff;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.cust-panel__close:hover { background: rgba(255, 255, 255, 0.28); }
.cust-panel__close svg { width: 18px; height: 18px; }

/* Panel body (scrollable) */
.cust-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  -webkit-overflow-scrolling: touch;
}
.cust-panel__body::-webkit-scrollbar { width: 8px; }
.cust-panel__body::-webkit-scrollbar-track { background: transparent; }
.cust-panel__body::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ms-brand, #9333ea) 30%, transparent); border-radius: 999px; }

/* Section */
.cust-section__title {
  font-family: var(--font-display, 'Plus Jakarta Sans', sans-serif);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-soft, #9ca3af);
  margin: 0 0 12px;
}
.cust-section__hint {
  font-size: 12px;
  color: var(--fg-muted, #6b7280);
  margin: -6px 0 12px;
  line-height: 1.5;
}

/* Theme grid (radio cards) */
.cust-theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.cust-theme {
  position: relative;
  padding: 12px;
  border: 2px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: var(--bg, #fff);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: inherit;
  color: inherit;
  text-align: left;
}
.cust-theme:hover { border-color: color-mix(in srgb, var(--ms-brand, #9333ea) 40%, var(--border, #e5e7eb)); transform: translateY(-1px); }
.cust-theme--active { border-color: var(--ms-brand, #9333ea); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ms-brand, #9333ea) 18%, transparent); }
.cust-theme__swatches {
  display: flex;
  gap: 3px;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
}
.cust-theme__swatches span { flex: 1; }
.cust-theme__name { font-size: 12px; font-weight: 600; color: var(--fg, #18181b); }
.cust-theme__check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ms-brand, #9333ea);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.cust-theme--active .cust-theme__check { display: flex; }
.cust-theme__check svg { width: 12px; height: 12px; }

/* Button group (radio buttons in a row) */
.cust-btn-group {
  display: flex;
  gap: 4px;
  background: var(--bg-muted, #f1f1f6);
  border-radius: 12px;
  padding: 4px;
  flex-wrap: wrap;
}
.cust-btn-group button {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--fg-muted, #6b7280);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.cust-btn-group button:hover { color: var(--fg, #18181b); }
.cust-btn-group button.cust-active {
  background: var(--ms-brand-gradient, linear-gradient(135deg, #9333ea, #a855f7));
  color: #fff;
  box-shadow: 0 4px 10px -2px color-mix(in srgb, var(--ms-brand, #9333ea) 40%, transparent);
}

/* Font family list (vertical) */
.cust-font-list { display: flex; flex-direction: column; gap: 4px; }
.cust-font {
  padding: 12px 14px;
  border: 2px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: var(--bg, #fff);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: inherit;
  color: inherit;
}
.cust-font:hover { border-color: color-mix(in srgb, var(--ms-brand, #9333ea) 40%, var(--border, #e5e7eb)); }
.cust-font--active { border-color: var(--ms-brand, #9333ea); background: color-mix(in srgb, var(--ms-brand, #9333ea) 6%, var(--bg, #fff)); }
.cust-font__name { font-size: 14px; font-weight: 600; color: var(--fg, #18181b); }
.cust-font__preview { font-size: 18px; color: var(--fg-muted, #6b7280); font-weight: 600; }

/* Slider */
.cust-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cust-slider {
  flex: 1;
  height: 6px;
  background: var(--bg-muted, #f1f1f6);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.cust-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ms-brand-gradient, linear-gradient(135deg, #9333ea, #a855f7));
  cursor: pointer;
  box-shadow: 0 4px 10px -2px color-mix(in srgb, var(--ms-brand, #9333ea) 40%, transparent);
  border: 2px solid #fff;
}
.cust-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ms-brand, #9333ea);
  cursor: pointer;
  border: 2px solid #fff;
}
.cust-slider-value {
  font-family: var(--font-display, 'Plus Jakarta Sans', sans-serif);
  font-weight: 700;
  font-size: 14px;
  color: var(--ms-brand, #9333ea);
  min-width: 44px;
  text-align: right;
}

/* Vision mode list (vertical radio cards) */
.cust-vision-list { display: flex; flex-direction: column; gap: 4px; }
.cust-vision {
  padding: 12px 14px;
  border: 2px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: var(--bg, #fff);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  color: inherit;
  text-align: left;
}
.cust-vision:hover { border-color: color-mix(in srgb, var(--ms-brand, #9333ea) 40%, var(--border, #e5e7eb)); }
.cust-vision--active { border-color: var(--ms-brand, #9333ea); background: color-mix(in srgb, var(--ms-brand, #9333ea) 6%, var(--bg, #fff)); }
.cust-vision__swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.cust-vision__text { flex: 1; }
.cust-vision__name { font-size: 13px; font-weight: 600; color: var(--fg, #18181b); }
.cust-vision__desc { font-size: 11px; color: var(--fg-muted, #6b7280); margin-top: 2px; line-height: 1.4; }

/* Reset button */
.cust-panel__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border, #e5e7eb);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.cust-reset-btn {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--border-strong, #d1d5db);
  background: var(--bg, #fff);
  color: var(--fg-muted, #6b7280);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.cust-reset-btn:hover { color: var(--fg, #18181b); border-color: var(--fg-muted, #6b7280); }
.cust-reset-btn svg { width: 14px; height: 14px; }

/* Backdrop */
.cust-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 997;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.cust-backdrop--open { opacity: 1; pointer-events: auto; }
@media (max-width: 480px) { .cust-backdrop { display: none; } }

/* ============== THEME DEFINITIONS ============== */
/* Each theme overrides CSS custom properties. Themes are applied via
   data-theme attribute on <html>. */

/* Light themes (default, plus light variants) */
:root, [data-theme="default"], [data-theme="light"] {
  --bg: #f7f7fb;
  --bg-elevated: #ffffff;
  --bg-muted: #f1f1f6;
  --fg: #18181b;
  --fg-muted: #6b7280;
  --fg-soft: #9ca3af;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --ms-brand: #9333ea;
  --ms-brand-soft: #a855f7;
  --ms-brand-deep: #7e22ce;
  --ms-brand-gradient: linear-gradient(135deg, #9333ea 0%, #7e22ce 60%, #6b21a8 100%);
}

[data-theme="dark"] {
  --bg: #0f0f12;
  --bg-elevated: #18181b;
  --bg-muted: #1f1f25;
  --fg: #f4f4f5;
  --fg-muted: #a1a1aa;
  --fg-soft: #71717a;
  --border: #27272a;
  --border-strong: #3f3f46;
  --ms-brand: #a855f7;
  --ms-brand-soft: #c084fc;
  --ms-brand-deep: #9333ea;
  --ms-brand-gradient: linear-gradient(135deg, #a855f7 0%, #9333ea 60%, #7e22ce 100%);
}

[data-theme="luxury"] {
  --bg: #1a1410;
  --bg-elevated: #251c16;
  --bg-muted: #2f2519;
  --fg: #f5e6d3;
  --fg-muted: #c4a880;
  --fg-soft: #8a7355;
  --border: #3d3024;
  --border-strong: #5c4a36;
  --ms-brand: #d4af37;
  --ms-brand-soft: #e8c558;
  --ms-brand-deep: #b8941f;
  --ms-brand-gradient: linear-gradient(135deg, #d4af37 0%, #b8941f 60%, #8a7355 100%);
}

[data-theme="retro"] {
  --bg: #f4ecd8;
  --bg-elevated: #faf5e6;
  --bg-muted: #ebe0c2;
  --fg: #3a2e1f;
  --fg-muted: #6b5840;
  --fg-soft: #9a876a;
  --border: #d4c5a0;
  --border-strong: #b8a47a;
  --ms-brand: #c2410c;
  --ms-brand-soft: #ea580c;
  --ms-brand-deep: #9a3412;
  --ms-brand-gradient: linear-gradient(135deg, #c2410c 0%, #9a3412 60%, #7c2d12 100%);
}

[data-theme="arctic"] {
  --bg: #f0f7fb;
  --bg-elevated: #ffffff;
  --bg-muted: #e1edf3;
  --fg: #1e3a5f;
  --fg-muted: #5a7896;
  --fg-soft: #95acc2;
  --border: #cfdfe9;
  --border-strong: #a8c2d4;
  --ms-brand: #0891b2;
  --ms-brand-soft: #06b6d4;
  --ms-brand-deep: #0e7490;
  --ms-brand-gradient: linear-gradient(135deg, #0891b2 0%, #0e7490 60%, #155e75 100%);
}

[data-theme="nature"] {
  --bg: #f0f7f1;
  --bg-elevated: #ffffff;
  --bg-muted: #e1efe3;
  --fg: #1a3a23;
  --fg-muted: #4f6b58;
  --fg-soft: #8aa395;
  --border: #c9e0cd;
  --border-strong: #9ec4a6;
  --ms-brand: #059669;
  --ms-brand-soft: #10b981;
  --ms-brand-deep: #047857;
  --ms-brand-gradient: linear-gradient(135deg, #059669 0%, #047857 60%, #064e3b 100%);
}

[data-theme="ember"] {
  --bg: #1f1310;
  --bg-elevated: #2a1a16;
  --bg-muted: #35221c;
  --fg: #fee2e2;
  --fg-muted: #d4a5a5;
  --fg-soft: #a06868;
  --border: #3d2823;
  --border-strong: #5c3a32;
  --ms-brand: #ef4444;
  --ms-brand-soft: #f87171;
  --ms-brand-deep: #dc2626;
  --ms-brand-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 60%, #991b1b 100%);
}

[data-theme="dracula"] {
  --bg: #282a36;
  --bg-elevated: #2f313f;
  --bg-muted: #383b4a;
  --fg: #f8f8f2;
  --fg-muted: #bcbcbc;
  --fg-soft: #6272a4;
  --border: #44475a;
  --border-strong: #6272a4;
  --ms-brand: #bd93f9;
  --ms-brand-soft: #d4b5ff;
  --ms-brand-deep: #a678e8;
  --ms-brand-gradient: linear-gradient(135deg, #bd93f9 0%, #ff79c6 60%, #ff79c6 100%);
}

[data-theme="midnight"] {
  --bg: #0a0e27;
  --bg-elevated: #131836;
  --bg-muted: #1c2244;
  --fg: #e2e8f0;
  --fg-muted: #94a3b8;
  --fg-soft: #475569;
  --border: #2a3454;
  --border-strong: #475569;
  --ms-brand: #818cf8;
  --ms-brand-soft: #a5b4fc;
  --ms-brand-deep: #6366f1;
  --ms-brand-gradient: linear-gradient(135deg, #818cf8 0%, #6366f1 60%, #4f46e5 100%);
}

/* ============== FONT FAMILY ============== */
[data-font="plus-jakarta"] { --font-display: 'Plus Jakarta Sans', system-ui, sans-serif; --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif; }
[data-font="inter"] { --font-display: 'Inter', system-ui, sans-serif; --font-sans: 'Inter', system-ui, sans-serif; }
[data-font="roboto"] { --font-display: 'Roboto', system-ui, sans-serif; --font-sans: 'Roboto', system-ui, sans-serif; }
[data-font="dm-sans"] { --font-display: 'DM Sans', system-ui, sans-serif; --font-sans: 'DM Sans', system-ui, sans-serif; }

/* ============== FONT SIZE ============== */
html[data-fontsize="12"] { font-size: 12px; }
html[data-fontsize="13"] { font-size: 13px; }
html[data-fontsize="14"] { font-size: 14px; }
html[data-fontsize="15"] { font-size: 15px; }
html[data-fontsize="16"] { font-size: 16px; }
html[data-fontsize="17"] { font-size: 17px; }
html[data-fontsize="18"] { font-size: 18px; }
html[data-fontsize="19"] { font-size: 19px; }
html[data-fontsize="20"] { font-size: 20px; }

/* ============== VISION MODE (color blindness filters) ============== */
/* Applied via CSS filter on <body> */
html[data-vision="protanopia"] body { filter: url(#cust-filter-protanopia) !important; }
html[data-vision="deuteranopia"] body { filter: url(#cust-filter-deuteranopia) !important; }
html[data-vision="tritanopia"] body { filter: url(#cust-filter-tritanopia) !important; }
html[data-vision="achromatopsia"] body { filter: grayscale(100%) !important; }

/* The SVG filters are injected by customize.js */
