/* =========================================================================
   BloomBux — theme.css (shared by index, earn dashboard, admin)
   Tokens, base, buttons, form fields, dialogs, FAQ accordion.
   Dark plum by default, light mode supported (toggle via shared.js).

   Colour roles
     pink  = brand / interactive      gold = Robux & balances
     green = success                  ink  = text
   ========================================================================= */

:root {
  --font-display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

html, html.theme-dark {
  color-scheme: dark;
  --bg: #130d1a;
  --bg-soft: #1a1224;
  --card: #211730;
  --card-edge: #352649;
  --card-edge-soft: #2a1e3b;
  --ink: #fdf0f8;
  --ink-soft: #b9a7c9;
  --shadow-color: rgba(5, 0, 10, 0.45);

  --pink: #ff5fae;
  --pink-text: #ff86c3;
  --pink-dark: #e0389b;
  --pink-deep: #9c1e6c;
  --btn: #d4278a;
  --btn-hover: #e2339a;
  --pink-soft: rgba(255, 95, 174, 0.13);
  --pink-faint: rgba(255, 95, 174, 0.07);
  --pink-border: rgba(255, 95, 174, 0.34);

  --gold: #ffc94a;
  --gold-ink: #ffd978;
  --gold-soft: rgba(255, 201, 74, 0.14);
  --gold-border: rgba(255, 201, 74, 0.38);

  --green: #4be3a8;
  --green-dark: #159c64;
  --green-soft: rgba(75, 227, 168, 0.13);
  --danger: #ff6b87;
}

html.theme-light {
  color-scheme: light;
  --bg: #fff7fb;
  --bg-soft: #ffeaf4;
  --card: #ffffff;
  --card-edge: #f6cfe3;
  --card-edge-soft: #fbe0ee;
  --ink: #2b1032;
  --ink-soft: #6f4a7a;
  --shadow-color: rgba(176, 37, 122, 0.14);

  --pink: #ff4fa3;
  --pink-text: #b81f78;
  --pink-dark: #e0389b;
  --pink-deep: #9c1e6c;
  --btn: #d4278a;
  --btn-hover: #c01f7a;
  --pink-soft: #ffe3f1;
  --pink-faint: #fff0f8;
  --pink-border: #f6bcd8;

  --gold: #ffc94a;
  --gold-ink: #6b4700;
  --gold-soft: #fff1c7;
  --gold-border: #f0d27a;

  --green: #12805a;
  --green-dark: #0e6847;
  --green-soft: #dcf7ea;
  --danger: #c81e45;
}

/* ---------------- base ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background .25s ease, color .25s ease;
}
h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 .6rem;
  text-wrap: balance;
}
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1rem; }
a { color: var(--pink-text); }
img { max-width: 100%; }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; border-radius: 6px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.fineprint { font-size: .8rem; color: var(--ink-soft); line-height: 1.5; }

/* ---------------- logo ---------------- */
.logo {
  display: inline-flex; align-items: center; text-decoration: none; line-height: 0;
}
.logo::before { display: none; }
.logo-img {
  height: 38px; width: auto; max-width: 175px; object-fit: contain; display: block;
}
.logo-img-light { display: none; }
.logo-img-dark { display: block; }
html.theme-light .logo-img-dark { display: none; }
html.theme-light .logo-img-light { display: block; }

/* ---------------- robux currency icon (dark / light mode adaptive) ---------------- */
.robux-icon {
  display: inline-block;
  vertical-align: -0.16em;
  width: 1.15em;
  height: 1.15em;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-image: url('../img/robuxdarkmode.png');
  flex-shrink: 0;
}
html.theme-light .robux-icon {
  background-image: url('../img/robuxlightmode.png');
}
.robux-icon-bal {
  width: 0.85em;
  height: 0.85em;
  vertical-align: -0.06em;
  margin-right: 0.12em;
}

/* ---------------- svg icons ---------------- */
.ico-svg {
  display: inline-block;
  vertical-align: middle;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}
.ico-check {
  display: inline-block;
  vertical-align: -0.15em;
  width: 1.1em;
  height: 1.1em;
  color: var(--green);
  flex-shrink: 0;
}
.ico-external {
  display: inline-block;
  vertical-align: -0.12em;
  width: 0.9em;
  height: 0.9em;
  margin-left: 0.25em;
}
.ico-spin {
  animation: spin 1.2s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .75rem 1.5rem;
  border: 0; border-radius: 999px;
  font-weight: 700; font-size: 1rem; line-height: 1.2;
  cursor: pointer; text-decoration: none;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease, border-color .15s ease;
}
.btn-primary {
  color: #fff; background: var(--btn);
  box-shadow: 0 4px 0 var(--pink-deep);
}
.btn-primary:hover { background: var(--btn-hover); }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--pink-deep); }
.btn-primary[disabled] { opacity: .65; cursor: progress; }
.btn-ghost {
  color: var(--ink); background: transparent;
  border: 2px solid var(--card-edge);
}
.btn-ghost:hover { border-color: var(--pink); }
.btn-sm { min-height: 42px; padding: .45rem 1.2rem; font-size: .93rem; }
.btn-big { min-height: 56px; padding: .9rem 2rem; font-size: 1.1rem; }
.btn-block { width: 100%; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  background: var(--card); border: 1.5px solid var(--card-edge);
  color: var(--ink); font-size: 1.1rem; line-height: 1; cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.theme-toggle:hover { border-color: var(--pink); }
.theme-toggle:active { transform: scale(.92); }

/* ---------------- form fields (16px min = no iOS zoom) ---------------- */
.field {
  display: block; width: 100%; min-height: 50px;
  padding: .7rem 1rem; font-size: 1rem;
  border-radius: 14px; border: 2px solid var(--card-edge);
  background: var(--card); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 4px var(--pink-soft); }
.field::placeholder { color: var(--ink-soft); opacity: .75; }
.field[readonly] { opacity: .75; }
.label { display: block; font-weight: 600; font-size: .9rem; margin: 1.1rem 0 .4rem; }
.hint { display: block; color: var(--ink-soft); font-size: .8rem; margin-top: .4rem; line-height: 1.45; }

/* ---------------- dialogs ---------------- */
dialog {
  width: min(420px, calc(100% - 2rem)); max-width: 420px;
  max-height: calc(100dvh - 2rem); overflow-y: auto; overscroll-behavior: contain;
  padding: 1.6rem; border: 1.5px solid var(--card-edge); border-radius: 26px;
  background: var(--bg-soft); color: var(--ink);
  box-shadow: 0 30px 80px var(--shadow-color);
}
dialog[open] { animation: popIn .22s ease both; }
dialog::backdrop { background: rgba(10, 4, 16, .72); backdrop-filter: blur(4px); }
.help-modal { width: min(580px, calc(100% - 2rem)); max-width: 580px; }
.help-modal h2 { font-size: 1.7rem; padding-right: 2.6rem; margin-bottom: 1.1rem; }
.modal-x {
  position: absolute; top: .6rem; right: .6rem;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: none; border: 0; cursor: pointer;
  color: var(--ink-soft); font-size: 1rem; font-weight: 700;
  transition: background .15s ease, color .15s ease;
}
.modal-x:hover { background: var(--card); color: var(--ink); }
.payout-explain p { color: var(--ink-soft); font-size: .96rem; }
.payout-explain strong { color: var(--ink); }

/* Phones: dialogs become bottom sheets */
@media (max-width: 560px) {
  dialog, .help-modal {
    width: 100%; max-width: 100%; margin: auto 0 0 0;
    max-height: 92dvh;
    border-radius: 26px 26px 0 0; border-bottom: 0;
    padding-bottom: calc(1.6rem + var(--safe-b));
  }
  dialog[open] { animation: sheetUp .28s cubic-bezier(.2, .8, .2, 1) both; }
}

/* ---------------- FAQ accordion (landing + dashboard modal) ---------------- */
.faq-list { display: grid; gap: .7rem; }
.faq-list details {
  background: var(--card); border: 1.5px solid var(--card-edge);
  border-radius: 18px; padding: 0 1.2rem;
  transition: border-color .2s ease;
}
.faq-list details[open] { border-color: var(--pink-border); }
.faq-list summary {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  min-height: 58px; padding: .9rem 0;
  font-weight: 700; cursor: pointer; list-style: none;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: '+'; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-soft); color: var(--pink-text);
  font-size: 1.25rem; font-weight: 800; line-height: 1;
  transition: transform .25s ease, background .2s ease;
}
.faq-list details[open] summary::after { transform: rotate(45deg); background: var(--pink-soft); }
.faq-list details > :not(summary) { color: var(--ink-soft); font-size: .97rem; }
.faq-list details > :last-child { margin-bottom: 1.15rem; }
.faq-list .list { display: grid; gap: .35rem; }

/* ---------------- animations ---------------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes shimmer { to { background-position: -200% 0; } }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .55s ease, transform .55s ease; }
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    animation-delay: 0s !important; transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
