/* White-label configurator — extends styles.css.
   Controls panel + live-updating phone preview.
   ----------------------------------------------------- */

.wl-configure { background: linear-gradient(180deg, rgba(124, 92, 255, 0.025) 0%, transparent 100%); }
.wl-configure .section-lede { margin-bottom: 56px; }

/* ─── Button reset for the configurator ───────────────────────
   Without this, Safari + some Chrome configurations apply the
   native control appearance, which renders buttons WHITE no
   matter what the inline `style="background:linear-gradient(...)"`
   says. Reset appearance so our own backgrounds take effect. */
.wl-configure button {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  margin: 0;
}

/* The configurator wrapper sets CSS variables that the phone reads.
   JS just flips these on the wrapper; no other DOM updates needed
   for the visual change. */
#cfg {
  --cfg-accent:    #7c5cff;
  --cfg-accent-2:  #3b6dff;
  --cfg-accent-soft:   rgba(124, 92, 255, 0.18);
  --cfg-accent-strong: rgba(124, 92, 255, 0.45);
  --cfg-icon-radius: 30%;
}

.cfg-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 60px;
  align-items: start;
}
@media (max-width: 980px) {
  .cfg-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .cfg-phone-wrap { position: static; }
}

/* ─── Controls panel ───────────────────────────────────────── */
.cfg-controls {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.cfg-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cfg-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0;
}
.cfg-help {
  font-size: 12px;
  color: var(--fg-dim);
  margin: 0;
}

/* Brand-name text input */
.cfg-input {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-strong);
  letter-spacing: -0.01em;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
.cfg-input:focus {
  border-color: var(--cfg-accent);
  box-shadow: 0 0 0 3px var(--cfg-accent-soft);
}

/* Quick-preset buttons */
.cfg-presets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.cfg-preset {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.cfg-preset:hover { border-color: var(--cfg-accent); }
.cfg-preset-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Color swatches (8 in a row, wraps) */
.cfg-swatches {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}
.cfg-swatch {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s, border-color 0.15s;
  position: relative;
}
.cfg-swatch:hover { transform: scale(1.08); }
.cfg-swatch.is-active {
  border-color: var(--fg-strong);
  box-shadow: 0 0 0 2px var(--bg);
}
.cfg-swatch.is-active::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--fg-strong);
}

/* Logo picker (6 in a row) */
.cfg-logos {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.cfg-logo {
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 6px;
  color: var(--cfg-accent);
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.cfg-logo svg { width: 100%; height: 100%; }
.cfg-logo:hover {
  border-color: var(--cfg-accent);
  transform: scale(1.05);
}
.cfg-logo.is-active {
  border-color: var(--cfg-accent);
  background: var(--cfg-accent-soft);
  box-shadow: 0 0 0 1px var(--cfg-accent-strong) inset;
}

/* Wallpaper picker (6 thumbnails) */
.cfg-papers {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.cfg-paper {
  aspect-ratio: 9/16;
  border: 2px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, transform 0.12s;
}
.cfg-paper:hover { transform: scale(1.05); }
.cfg-paper.is-active {
  border-color: var(--cfg-accent);
  box-shadow: 0 0 0 2px var(--cfg-accent-strong);
}

/* ─── Applications picker ──────────────────────────────────── */
.cfg-apps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cfg-app-chip {
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fg-mute);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.cfg-app-chip:hover {
  border-color: var(--cfg-accent);
  color: var(--fg);
}
.cfg-app-chip.is-active {
  background: var(--cfg-accent-soft);
  border-color: var(--cfg-accent-strong);
  color: var(--fg-strong);
}
.cfg-app-chip.is-active::before {
  content: "✓";
  margin-right: 6px;
  font-weight: 700;
  color: var(--cfg-accent);
}

/* ─── Hosting picker ───────────────────────────────────────── */
.cfg-hosting {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cfg-host {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.cfg-host:hover { border-color: var(--cfg-accent); }
.cfg-host.is-active {
  border-color: var(--cfg-accent);
  background: var(--cfg-accent-soft);
  box-shadow: 0 0 0 1px var(--cfg-accent-strong) inset;
}
.cfg-host-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-strong);
  letter-spacing: -0.01em;
}
.cfg-host-desc {
  font-size: 11.5px;
  color: var(--fg-mute);
  line-height: 1.45;
}

/* ─── VIP toggle ───────────────────────────────────────────── */
.cfg-vip {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 0.15s, background 0.15s;
}
.cfg-vip:hover { border-color: var(--cfg-accent); }
.cfg-vip.is-active {
  border-color: var(--cfg-accent);
  background: var(--cfg-accent-soft);
}
.cfg-vip-switch {
  display: inline-block;
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--bg-deep);
  border: 1px solid var(--line-strong, #2b3450);
  border-radius: 999px;
  flex-shrink: 0;
  margin-top: 2px;
  transition: background 0.18s, border-color 0.18s;
}
.cfg-vip-switch span {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--fg-mute);
  transition: left 0.18s, background 0.18s;
}
.cfg-vip.is-active .cfg-vip-switch {
  background: var(--cfg-accent);
  border-color: var(--cfg-accent);
}
.cfg-vip.is-active .cfg-vip-switch span {
  left: 17px;
  background: #fff;
}
.cfg-vip-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.cfg-vip-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-strong);
  letter-spacing: -0.01em;
}
.cfg-vip-desc {
  font-size: 11.5px;
  color: var(--fg-mute);
  line-height: 1.45;
}

/* ─── Live config summary ─────────────────────────────────── */
.cfg-summary {
  margin-top: 8px;
  padding: 14px 16px;
  background:
    linear-gradient(135deg, var(--cfg-accent-soft), transparent 70%),
    var(--bg-card);
  border: 1px solid var(--cfg-accent-strong);
  border-radius: 10px;
}
.cfg-summary-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--cfg-accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 10px;
}
.cfg-summary ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  margin: 0;
}
.cfg-summary li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12.5px;
}
.cfg-summary-key {
  color: var(--fg-mute);
}
.cfg-summary-val {
  color: var(--fg-strong);
  font-weight: 600;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  text-align: right;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Icon shape (3 radio-style buttons) */
.cfg-shapes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.cfg-shape {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 6px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  color: var(--fg-mute);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.cfg-shape-prev {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--cfg-accent), var(--cfg-accent-2));
  display: block;
}
.cfg-shape:hover { border-color: var(--cfg-accent); }
.cfg-shape.is-active {
  border-color: var(--cfg-accent);
  background: var(--cfg-accent-soft);
  color: var(--fg-strong);
}

/* ─── Phone preview ────────────────────────────────────────── */
.cfg-phone-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  /* Sticky so the live preview stays visible while the user
     scrolls through the (now quite long) controls column. */
  position: sticky;
  top: 100px;
  /* Without an explicit max-height the phone could exceed the
     viewport on shorter screens; clamp so it never overflows. */
  max-height: calc(100vh - 120px);
}

.cfg-view-toggle {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.cfg-view-btn {
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: var(--fg-mute);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}
.cfg-view-btn.is-active {
  background: var(--cfg-accent-soft);
  color: var(--fg-strong);
  box-shadow: 0 0 0 1px var(--cfg-accent-strong) inset;
}

.cfg-phone {
  /* Make the phone a touch larger here */
  width: min(100%, 320px);
}
.cfg-phone-screen {
  /* Override the existing phone-screen background so the wallpaper
     layer can show through. */
  background: #0a0d14;
  position: relative;
}
.cfg-wallpaper {
  position: absolute;
  inset: 0;
  z-index: 0;
  /* JS sets `background` directly on this element via inline style. */
  background: radial-gradient(ellipse at 30% 0%, rgba(124,92,255,0.45) 0%, transparent 50%), radial-gradient(ellipse at 70% 100%, rgba(59,109,255,0.4) 0%, transparent 50%), #0a0d14;
}
.cfg-phone .status-bar,
.cfg-view {
  position: relative;
  z-index: 1;
}

/* Lock view: leave existing .lock-screen styles in place; just tint
   the brand chrome with the configurator accent. */
.cfg-view-lock { display: flex; flex-direction: column; flex: 1; padding: 30px 20px 20px; align-items: center; text-align: center; }
.cfg-view-home { display: none; flex-direction: column; flex: 1; padding-top: 8px; }

.cfg-phone[data-view="home"] .cfg-view-lock { display: none; }
.cfg-phone[data-view="home"] .cfg-view-home { display: flex; }

/* Reusable lock-screen rules from styles.css already cover most.
   Override the brand color tint to follow --cfg-accent. */
.cfg-view-lock .lock-time { font-size: 64px; font-weight: 200; color: #fff; letter-spacing: -0.05em; line-height: 1; margin-top: 28px; font-feature-settings: "tnum"; text-shadow: 0 1px 6px rgba(0,0,0,0.5); }
.cfg-view-lock .lock-date { font-size: 12px; color: rgba(255,255,255,0.85); margin-top: 6px; font-weight: 500; letter-spacing: 0.02em; text-shadow: 0 1px 4px rgba(0,0,0,0.6); }
.cfg-view-lock .lock-brand { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cfg-view-lock .lock-brand-text { font-size: 14px; font-weight: 700; color: #fff; letter-spacing: -0.01em; margin: 0; text-shadow: 0 1px 4px rgba(0,0,0,0.6); }
.cfg-view-lock .lock-bottom { margin-top: 28px; display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 0 18px 6px; }
.cfg-view-lock .lock-bottom-icon { width: 32px; height: 32px; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; }

.cfg-logo-display {
  width: 32px;
  height: 32px;
  color: var(--cfg-accent);
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.5));
}
.cfg-logo-display svg { width: 100%; height: 100%; }

.cfg-pill {
  background: var(--cfg-accent-soft) !important;
  border-color: var(--cfg-accent-strong) !important;
  color: #fff;
}
.cfg-pill-dot {
  background: var(--cfg-accent) !important;
  box-shadow: 0 0 0 3px var(--cfg-accent-soft) !important;
}

/* Home view: 4×3 app grid + dock */
.cfg-home-apps {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 4px;
  padding: 14px 14px 12px;
}
.cfg-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.cfg-app-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--cfg-icon-radius, 30%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: border-radius 0.2s;
}

/* Per-icon background follows accent or a neutral; data-color-bg routes:
   primary = accent, alt = secondary accent, ok = neutral green, warn = neutral amber */
.cfg-app-icon[data-color-bg="primary"] { background: linear-gradient(135deg, var(--cfg-accent), var(--cfg-accent-2)); }
.cfg-app-icon[data-color-bg="alt"]     { background: linear-gradient(135deg, var(--cfg-accent-2), var(--cfg-accent)); }
.cfg-app-icon[data-color-bg="ok"]      { background: linear-gradient(135deg, #10b981, #0ea5a3); }
.cfg-app-icon[data-color-bg="warn"]    { background: linear-gradient(135deg, #f59e0b, #d97706); }

.cfg-app-name {
  font-size: 9.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.cfg-dock {
  margin: 4px 14px 16px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.cfg-dock .papp-icon-dock {
  border-radius: var(--cfg-icon-radius, 30%);
}

/* ─── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cfg-swatch, .cfg-logo, .cfg-paper, .cfg-shape, .cfg-app-icon { transition: none; }
}
