/*
 * A/B test light_theme, variant b: the new light theme for the chat page.
 * Only active on html[data-theme="light"][data-ab-lt="b"] (set by the server or js/ab-theme.js).
 *
 * Idea: a calm, warm-neutral page where the only saturated color on screen is the
 * buy button (gold). Primary everyday actions (new chat, send, login) are ink.
 * Nothing in the UI competes with "upgrade", so the eye lands on it.
 */
html[data-theme="light"][data-ab-lt="b"] {
  --bg: #ffffff;
  --bg-sidebar: #f6f4f0;
  --bg-main: #ffffff;
  --ink: #1c1917;
  --ink-60: rgba(28, 25, 23, 0.62);
  --ink-strong: #0c0a09;
  --ink-secondary: #292524;
  --muted: #6b645c;
  --stroke: #e9e4dc;
  --stroke-10: rgba(28, 25, 23, 0.08);
  --hover: #efebe4;
  --surface-soft: #f6f4f0;
  --surface-muted: #faf8f5;
  --card: #ffffff;
  --user-bubble: #f2eee8;
  --ai-bubble: #f6f4f0;
  --chip: #efebe4;
  --chip-fg: #1c1917;
  --combo: #f6f4f0;
  --composer: #ffffff;
  --composer-stroke: #e4ded5;
  --composer-placeholder: rgba(28, 25, 23, 0.4);
  --pill-stroke: rgba(28, 25, 23, 0.12);
  --btn: #1c1917;
  --btn-fg: #ffffff;
  --newchat-bg: #1c1917;
  --newchat-fg: #ffffff;
  --accent: #1c1917;
  --overlay: rgba(28, 25, 23, 0.34);
  --account-bento-bg: #f6f4f0;
  --account-bento-hover: #efebe4;
  --account-quota-bg: #f6f4f0;
  --account-input-bg: #ffffff;
  --shadow-composer: 0 1px 2px rgba(28, 25, 23, 0.05), 0 16px 44px rgba(68, 50, 26, 0.08);
  --shadow-composer-home: 0 1px 2px rgba(28, 25, 23, 0.05), 0 22px 56px rgba(68, 50, 26, 0.1);
  --scrollbar-thumb: rgba(28, 25, 23, 0.16);
  --scrollbar-thumb-hover: rgba(28, 25, 23, 0.28);

  /* Buy color: used only for upgrade / purchase. */
  --ab-gold: linear-gradient(180deg, #ffd766 0%, #f5a524 100%);
  --ab-gold-hover: linear-gradient(180deg, #ffde80 0%, #f7ad33 100%);
  --ab-gold-ink: #2b1700;
  --ab-gold-edge: rgba(176, 106, 0, 0.38);
  --ab-gold-glow: 0 1px 0 rgba(255, 255, 255, 0.55) inset, 0 8px 22px rgba(245, 165, 36, 0.38);
  --ab-gold-soft: #fff4d9;
  --ab-gold-text: #8a5300;
}

/* ---- shell ---- */
html[data-theme="light"][data-ab-lt="b"] .sidebar {
  background: var(--bg-sidebar);
  box-shadow: none;
  border: 1px solid #ede8e0;
}
html[data-theme="light"][data-ab-lt="b"] .btn-new {
  background: var(--newchat-bg);
  color: var(--newchat-fg);
  box-shadow: 0 6px 16px rgba(28, 25, 23, 0.18);
}
html[data-theme="light"][data-ab-lt="b"] .btn-new:hover { background: #292524; }
html[data-theme="light"][data-ab-lt="b"] .side-search {
  background: #ffffff;
  border-color: var(--stroke);
}
html[data-theme="light"][data-ab-lt="b"] .main.is-empty {
  background:
    radial-gradient(55% 38% at 50% 0%, rgba(255, 224, 170, 0.26), transparent 72%),
    #ffffff;
}
html[data-theme="light"][data-ab-lt="b"] .main.is-empty .empty-hero h2 { color: var(--ink-strong); }
html[data-theme="light"][data-ab-lt="b"] .empty-hero .mark { color: var(--ink-strong); }

/* ---- composer ---- */
html[data-theme="light"][data-ab-lt="b"] .composer {
  border-color: var(--composer-stroke);
  background: #ffffff;
}
html[data-theme="light"][data-ab-lt="b"] .composer:focus-within {
  border-color: #cfc6b8;
  box-shadow: 0 0 0 4px rgba(28, 25, 23, 0.05), var(--shadow-composer-home);
}
html[data-theme="light"][data-ab-lt="b"] .send.active {
  background: #1c1917;
  color: #ffffff;
}
html[data-theme="light"][data-ab-lt="b"] .send.active .ico-svg { color: #ffffff; }

/* ---- messages ---- */
html[data-theme="light"][data-ab-lt="b"] .msg-row.user .bubble {
  background: var(--user-bubble);
  color: var(--ink);
}

/* ---- sheets / forms (login is part of the buy path) ---- */
html[data-theme="light"][data-ab-lt="b"] .sheet {
  border-color: var(--stroke);
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.05), 0 30px 80px rgba(68, 50, 26, 0.14);
}
html[data-theme="light"][data-ab-lt="b"] .btn.primary {
  box-shadow: 0 6px 16px rgba(28, 25, 23, 0.2);
}
html[data-theme="light"][data-ab-lt="b"] .btn.ghost { border-color: var(--stroke); }
html[data-theme="light"][data-ab-lt="b"] .btn.ghost:hover { background: var(--surface-soft); }
html[data-theme="light"][data-ab-lt="b"] .field input:focus,
html[data-theme="light"][data-ab-lt="b"] .field textarea:focus,
html[data-theme="light"][data-ab-lt="b"] .field select:focus,
html[data-theme="light"][data-ab-lt="b"] .account-name-input:focus,
html[data-theme="light"][data-ab-lt="b"] .auth-otp-digit:focus {
  border-color: #1c1917;
  box-shadow: 0 0 0 3px rgba(28, 25, 23, 0.1);
}
html[data-theme="light"][data-ab-lt="b"] .sheet .list-row,
html[data-theme="light"][data-ab-lt="b"] .account-bento-item { border-color: #efeae2; }
html[data-theme="light"][data-ab-lt="b"] .sheet-back:hover { background: var(--hover); color: var(--ink); }
html[data-theme="light"][data-ab-lt="b"] .ticket-row { border-color: var(--stroke); }
html[data-theme="light"][data-ab-lt="b"] .ticket-row:hover,
html[data-theme="light"][data-ab-lt="b"] .gal-item { background: var(--surface-soft); }

/* Quota bar in gold: running low reads as "upgrade", not as an error. */
html[data-theme="light"][data-ab-lt="b"] .quota-meter-fill { background: var(--ab-gold); }

/* ---- upgrade: the one saturated thing on the page ---- */
html[data-theme="light"][data-ab-lt="b"] .topbar .top-subscribe-btn.side-link-subscribe:not(.is-active-sub) {
  height: 36px;
  padding-inline: 14px 16px;
  border-radius: 999px;
  background: var(--ab-gold);
  border: 1px solid var(--ab-gold-edge);
  color: var(--ab-gold-ink);
  box-shadow: var(--ab-gold-glow);
  overflow: hidden;
  isolation: isolate;
}
html[data-theme="light"][data-ab-lt="b"] .topbar .top-subscribe-btn.side-link-subscribe:not(.is-active-sub):hover {
  background: var(--ab-gold-hover);
  filter: none;
}
html[data-theme="light"][data-ab-lt="b"] .topbar .top-subscribe-btn.side-link-subscribe:not(.is-active-sub) b,
html[data-theme="light"][data-ab-lt="b"] .topbar .top-subscribe-btn.side-link-subscribe:not(.is-active-sub) .subscribe-ico .ico-svg {
  color: var(--ab-gold-ink);
  -webkit-text-fill-color: var(--ab-gold-ink);
  background: none;
  animation: none;
  filter: none;
}
@media (max-width: 980px) {
  html[data-theme="light"][data-ab-lt="b"] .topbar .top-subscribe-btn.side-link-subscribe:not(.is-active-sub) {
    position: relative;
  }
}
/* Light sweep every few seconds. */
html[data-theme="light"][data-ab-lt="b"] .topbar .top-subscribe-btn.side-link-subscribe:not(.is-active-sub)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.75) 48%, transparent 66%);
  transform: translateX(-120%);
  animation: ab-gold-sweep 5.5s ease-in-out 1.2s infinite;
  pointer-events: none;
}
@keyframes ab-gold-sweep {
  0%, 70% { transform: translateX(-120%); }
  90%, 100% { transform: translateX(120%); }
}

html[data-theme="light"][data-ab-lt="b"] .side-link-subscribe:not(.is-active-sub):not(.top-subscribe-btn),
html[data-theme="light"][data-ab-lt="b"] .list-row-subscribe:not(.is-active-sub) {
  color: var(--ab-gold-text);
  background: var(--ab-gold-soft);
  box-shadow: inset 0 0 0 1px rgba(245, 165, 36, 0.3);
}
html[data-theme="light"][data-ab-lt="b"] .side-link-subscribe:not(.is-active-sub):not(.top-subscribe-btn):hover,
html[data-theme="light"][data-ab-lt="b"] .list-row-subscribe:not(.is-active-sub):hover {
  background: #ffecbf;
}
html[data-theme="light"][data-ab-lt="b"] .side-link-subscribe:not(.is-active-sub):not(.top-subscribe-btn) b,
html[data-theme="light"][data-ab-lt="b"] .list-row-subscribe:not(.is-active-sub) b {
  background: none;
  color: var(--ab-gold-text);
  -webkit-text-fill-color: var(--ab-gold-text);
  animation: none;
}
html[data-theme="light"][data-ab-lt="b"] .side-link-subscribe:not(.is-active-sub):not(.top-subscribe-btn) .subscribe-ico .ico-svg,
html[data-theme="light"][data-ab-lt="b"] .list-row-subscribe:not(.is-active-sub) .subscribe-ico .ico-svg {
  color: #e08a00;
  animation: none;
  filter: none;
}

html[data-theme="light"][data-ab-lt="b"] .upgrade-card-btn:not(.upgrade-card-btn-ghost) {
  background: var(--ab-gold);
  color: var(--ab-gold-ink);
  border: 1px solid var(--ab-gold-edge);
  box-shadow: var(--ab-gold-glow);
}
html[data-theme="light"][data-ab-lt="b"] .upgrade-card-btn:not(.upgrade-card-btn-ghost) .ico-svg { color: var(--ab-gold-ink); }

/* ---- sidebar upsell card (variant b, free and guest users) ---- */
.ab-upsell { display: none; }
html[data-theme="light"][data-ab-lt="b"] .ab-upsell {
  display: block;
  position: relative;
  margin: 8px 12px 10px;
  padding: 14px 14px 12px;
  border-radius: 18px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 215, 102, 0.35), transparent 60%),
    #ffffff;
  border: 1px solid #f0e2c4;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 10px 26px rgba(176, 106, 0, 0.08);
  color: var(--ink);
}
.ab-upsell[hidden] { display: none !important; }
.ab-upsell-x {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 18px;
  line-height: 26px;
  text-align: center;
}
.ab-upsell-x:hover { background: var(--hover); color: var(--ink); }
.ab-upsell-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--ab-gold);
  color: var(--ab-gold-ink);
  font-size: 11px;
  font-weight: 800;
}
.ab-upsell-title {
  display: block;
  margin: 8px 0 6px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.ab-upsell ul {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 4px;
}
.ab-upsell li {
  position: relative;
  padding-inline-start: 18px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-secondary);
}
.ab-upsell li::before {
  content: "";
  position: absolute;
  inset-inline-start: 2px;
  top: 0.62em;
  width: 8px;
  height: 5px;
  border-left: 2px solid #d48806;
  border-bottom: 2px solid #d48806;
  transform: rotate(-45deg);
}
.ab-upsell-cta {
  width: 100%;
  height: 40px;
  border-radius: 12px;
  background: var(--ab-gold);
  border: 1px solid var(--ab-gold-edge);
  color: var(--ab-gold-ink);
  box-shadow: var(--ab-gold-glow);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.ab-upsell-cta:hover { background: var(--ab-gold-hover); }
@media (max-height: 640px) {
  html[data-theme="light"][data-ab-lt="b"] .ab-upsell ul { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme="light"][data-ab-lt="b"] .topbar .top-subscribe-btn.side-link-subscribe:not(.is-active-sub)::after {
    animation: none;
    display: none;
  }
}
