/* =============================================================
   Subscribe flow. Builds on front.css tokens (with fallbacks).
   Everything is scoped under .fs-section / .fs-* so it can't
   collide with the landing page styles.
   ============================================================= */

.fs-section {
  --fs-primary: var(--color-primary, #D62828);
  --fs-primary-dark: var(--color-primary-dark, #B81F1F);
  --fs-navy: var(--color-navy, #1B2A4A);
  --fs-text: var(--color-text, #1B2A4A);
  --fs-muted: var(--color-text-muted, #5B6478);
  --fs-border: var(--color-border, #E3E6EE);
  --fs-bg: var(--color-bg, #F6F7FB);
  --fs-soft: var(--color-red-soft, #FDECEC);
  --fs-display: var(--font-display, 'Bricolage Grotesque', system-ui, sans-serif);
  --fs-body: var(--font-body, 'Inter', system-ui, sans-serif);
  --fs-ui: var(--font-ui, 'Plus Jakarta Sans', system-ui, sans-serif);

  background: var(--fs-bg);
  color: var(--fs-text);
  font-family: var(--fs-body);
  padding: clamp(48px, 7vw, 96px) 0 clamp(64px, 9vw, 120px);
  min-height: 70vh;
}

/* `hidden` must win over the display rules below */
.fs-section [hidden] { display: none !important; }

.fs-section :focus-visible {
  outline: 3px solid rgba(214, 40, 40, 0.4);
  outline-offset: 2px;
}

/* ---------- Header ---------- */
.fs-head { text-align: center; max-width: 620px; margin: 0 auto 32px; }

.fs-title {
  font-family: var(--fs-display);
  font-size: clamp(32px, 4.6vw, 50px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--fs-navy);
  margin: 0 0 12px;
}

.fs-sub { font-size: 17px; line-height: 1.6; color: var(--fs-muted); margin: 0; }

/* ---------- Stepper (a real sequence, so numbered) ---------- */
.fs-steps {
  display: flex;
  justify-content: center;
  align-items: center;
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
}

.fs-steps li { display: flex; align-items: center; gap: 10px; color: var(--fs-muted); font-family: var(--fs-ui); font-size: 14px; font-weight: 600; }
.fs-steps li + li::before { content: ''; width: clamp(24px, 7vw, 56px); height: 2px; background: var(--fs-border); margin: 0 12px; }

.fs-step-dot {
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid var(--fs-border);
  background: #fff;
  font-size: 13px;
}

.fs-steps li.is-done .fs-step-dot { background: var(--fs-navy); border-color: var(--fs-navy); color: #fff; }
.fs-steps li.is-active .fs-step-dot { background: var(--fs-primary); border-color: var(--fs-primary); color: #fff; }
.fs-steps li.is-active { color: var(--fs-navy); }
.fs-steps li.is-done + li::before,
.fs-steps li.is-active + li.is-done::before { background: var(--fs-navy); }

.fs-userbar { text-align: center; font-size: 14px; color: var(--fs-muted); margin: -8px 0 24px; }
.fs-userbar strong { color: var(--fs-navy); }

/* ---------- Shared: cards, alerts, links ---------- */
.fs-card { position: relative; }

.fs-card--form,
.fs-card--done {
  background: #fff;
  border: 1px solid var(--fs-border);
  border-radius: 24px;
  padding: clamp(24px, 4vw, 36px);
  margin: 0 auto;
}
.fs-card--form { max-width: 480px; }
.fs-card--done { max-width: 560px; text-align: center; }

.fs-h2 {
  font-family: var(--fs-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--fs-navy);
  margin: 0 0 20px;
}
.fs-h2:focus { outline: none; }
.fs-card--done .fs-h2 { margin-bottom: 8px; }

.fs-lead { color: var(--fs-muted); margin: 0 0 20px; font-size: 16px; line-height: 1.6; }
.fs-fine { color: var(--fs-muted); font-size: 13.5px; margin: 20px 0 0; }
.fs-note { color: var(--fs-muted); font-size: 13.5px; text-align: center; max-width: 560px; margin: 24px auto 0; }

.fs-alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5; margin-bottom: 16px; text-align: left; border: 1px solid transparent; }
.fs-alert.is-danger  { background: var(--fs-soft); border-color: #F4C2C2; color: #8B1D1D; }
.fs-alert.is-info    { background: #EEF3FF; border-color: #CBD8F6; color: var(--fs-navy); }
.fs-alert.is-success { background: #EAF7EF; border-color: #BFE3CB; color: #1E5B34; }

.fs-link {
  background: none; border: 0; padding: 0;
  color: var(--fs-primary);
  font-family: var(--fs-ui); font-weight: 600; font-size: inherit;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.fs-link:hover { color: var(--fs-primary-dark); }

/* ---------- Loader overlay ---------- */
.fs-loader {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(255, 255, 255, 0.86);
  border-radius: inherit;
  backdrop-filter: blur(2px);
}
.fs-loader .spinner-border { color: var(--fs-primary); width: 2.4rem; height: 2.4rem; }
.fs-loader-text { margin: 0; font-family: var(--fs-ui); font-weight: 600; color: var(--fs-navy); }
.fs-card--bare .fs-loader { background: rgba(246, 247, 251, 0.86); }

/* ---------- Plans: toolbar ---------- */
.fs-toolbar {
  display: flex; flex-wrap: wrap; gap: 16px 24px;
  align-items: center; justify-content: space-between;
  max-width: 1100px; margin: 0 auto 28px;
}

.fs-currency { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14.5px; color: var(--fs-muted); }
.fs-currency strong { color: var(--fs-navy); }
/* Currency picker (Choices.js; the native select is the no-JS fallback) */
.fs-currency-pick { min-width: 230px; }
.fs-currency-pick > select { border: 1px solid var(--fs-border); border-radius: 999px; padding: 6px 14px; font-size: 14px; background: #fff; }
.fs-currency .choices { margin: 0; font-size: 14px; }
.fs-currency .choices__inner {
  min-height: 38px; padding: 5px 34px 5px 14px;
  border: 1px solid var(--fs-border); border-radius: 999px; background: #fff;
  display: flex; align-items: center;
}
.fs-currency .choices.is-open .choices__inner { border-radius: 19px 19px 0 0; }
.fs-currency .choices.is-focused .choices__inner,
.fs-currency .choices.is-open .choices__inner { border-color: var(--fs-navy); }
.fs-currency .choices__list--single { padding: 0; color: var(--fs-navy); font-weight: 600; }
.fs-currency .choices[data-type*='select-one']::after { right: 14px; }
.fs-currency .choices__list--dropdown,
.fs-currency .choices__list[aria-expanded] { border-color: var(--fs-border); border-radius: 0 0 16px 16px; z-index: 30; min-width: 260px; }
.fs-currency .choices__list--dropdown .choices__item { font-size: 14px; padding: 9px 14px; }
.fs-currency .choices__list--dropdown .choices__item.is-highlighted { background: var(--fs-bg); }
.fs-currency .choices__input { font-size: 14px; }

.fs-intervals { display: inline-flex; padding: 4px; background: #fff; border: 1px solid var(--fs-border); border-radius: 999px; }
.fs-intervals button {
  border: 0; background: transparent; cursor: pointer;
  font-family: var(--fs-ui); font-weight: 600; font-size: 14px; color: var(--fs-muted);
  padding: 8px 18px; border-radius: 999px;
}
.fs-intervals button.is-on { background: var(--fs-navy); color: #fff; }

/* ---------- Plans: cards ---------- */
.fs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 340px));
  justify-content: center;
  gap: 24px;
  align-items: stretch;
}

.fs-plan {
  position: relative;
  display: flex; flex-direction: column; gap: 14px;
  background: #fff;
  border: 1px solid var(--fs-border);
  border-radius: 24px;
  padding: 30px 28px 28px;
}

.fs-plan-name { font-family: var(--fs-display); font-size: 22px; font-weight: 800; margin: 0; color: var(--fs-navy); }
.fs-plan-desc { margin: -4px 0 0; color: var(--fs-muted); font-size: 14.5px; line-height: 1.55; }

.fs-price { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; }
.fs-amount { font-family: var(--fs-display); font-size: 40px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; color: var(--fs-navy); }
.fs-per { color: var(--fs-muted); font-size: 14px; }
.fs-price--na { font-size: 14.5px; color: var(--fs-muted); min-height: 40px; align-items: center; }
.fs-charged { margin-top: -8px; font-size: 13px; color: var(--fs-muted); }

.fs-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fs-chip { font-family: var(--fs-ui); font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.fs-chip--trial { background: var(--fs-soft); color: #9A1F1F; }
.fs-chip--save  { background: #E7F5EC; color: #1E6B3B; }

.fs-choose { width: 100%; justify-content: center; margin-top: 6px; }
.fs-choose[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

.fs-features { list-style: none; margin: 8px 0 0; padding: 18px 0 0; border-top: 1px solid var(--fs-border); display: grid; gap: 10px; }
.fs-features li { display: flex; gap: 10px; font-size: 14.5px; line-height: 1.4; }
.fs-features li i { color: var(--fs-primary); flex: none; margin-top: 2px; }
.fs-features li.is-off { color: var(--fs-muted); }
.fs-features li.is-off i { color: #AAB0BF; }
.fs-features b { font-weight: 700; color: var(--fs-navy); }

/* One plan can be highlighted (plan.badge / is_popular / is_featured). */
.fs-plan.is-featured { background: var(--fs-navy); border-color: var(--fs-navy); color: #fff; }
.fs-plan.is-featured .fs-plan-name,
.fs-plan.is-featured .fs-amount,
.fs-plan.is-featured .fs-features b { color: #fff; }
.fs-plan.is-featured .fs-plan-desc,
.fs-plan.is-featured .fs-per,
.fs-plan.is-featured .fs-charged { color: rgba(255, 255, 255, 0.72); }
.fs-plan.is-featured .fs-features { border-top-color: rgba(255, 255, 255, 0.16); }
.fs-plan.is-featured .fs-features li.is-off { color: rgba(255, 255, 255, 0.5); }
.fs-plan.is-featured .fs-chip--trial { background: rgba(255, 255, 255, 0.14); color: #fff; }
.fs-ribbon {
  position: absolute; top: -12px; left: 28px;
  background: var(--fs-primary); color: #fff;
  font-family: var(--fs-ui); font-size: 12.5px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px;
}

.fs-empty { text-align: center; padding: 48px 16px; color: var(--fs-muted); }

/* ---------- Forms ---------- */
.fs-field { margin-bottom: 16px; }
.fs-field label { display: block; font-family: var(--fs-ui); font-size: 14px; font-weight: 600; color: var(--fs-navy); margin-bottom: 6px; }

.fs-section .form-control,
.fs-section .form-select {
  border-radius: 14px;
  border: 1px solid var(--fs-border);
  padding: 11px 14px;
  font-size: 15px;
  min-height: 48px;
}
.fs-section .form-control:focus,
.fs-section .form-select:focus { border-color: var(--fs-primary); box-shadow: 0 0 0 4px rgba(214, 40, 40, 0.12); }

.fs-section .input-group .form-control { border-radius: 14px 0 0 14px; }
.fs-eye { border: 1px solid var(--fs-border); border-left: 0; border-radius: 0 14px 14px 0; background: #fff; color: var(--fs-muted); padding: 0 14px; }
.fs-eye:hover { color: var(--fs-navy); }
.input-group .form-control.is-invalid + .fs-eye { border-color: #dc3545; }

.fs-hint { font-size: 13px; color: var(--fs-muted); margin-top: 6px; }
.fs-error { color: #B42318; font-size: 13.5px; margin-top: 6px; }
.fs-error:empty { display: none; }

.fs-submit { width: 100%; justify-content: center; margin-top: 8px; }

.fs-switch {
  display: flex; flex-direction: column; align-items: stretch; gap: 12px;
  margin-top: 24px; padding-top: 22px;
  border-top: 1px solid var(--fs-border);
  text-align: center; font-size: 14.5px; color: var(--fs-muted);
}
.fs-switch--inline { flex-direction: row; justify-content: center; flex-wrap: wrap; gap: 6px; border-top: 0; padding-top: 0; margin-top: 20px; }

.fs-summary {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  background: var(--fs-bg); border-radius: 16px; padding: 16px 18px; margin-bottom: 22px;
  font-size: 14.5px; color: var(--fs-muted);
}
.fs-summary-main { display: flex; flex-direction: column; gap: 2px; }
.fs-summary-main strong { font-size: 17px; color: var(--fs-navy); font-family: var(--fs-display); }
.fs-summary-label { font-size: 12.5px; }
.fs-summary-charged { font-size: 13px; }

/* ---------- Country select (Choices.js + flags) ---------- */
.fs-country .choices { margin-bottom: 0; }
.fs-country .choices__inner {
  min-height: 48px; padding: 9px 14px;
  border: 1px solid var(--fs-border); border-radius: 14px; background: #fff; font-size: 15px;
  display: flex; align-items: center;
}
.fs-country .choices.is-focused .choices__inner,
.fs-country .choices.is-open .choices__inner { border-color: var(--fs-primary); box-shadow: 0 0 0 4px rgba(214, 40, 40, 0.12); }
.fs-country .choices.fs-invalid .choices__inner { border-color: #dc3545; }
.fs-country .choices__list--single { padding: 0; }
.fs-country .choices[data-type*='select-one']::after { right: 16px; }
.fs-country .choices__list--dropdown,
.fs-country .choices__list[aria-expanded] { border-radius: 14px; border-color: var(--fs-border); z-index: 20; }
.fs-country .choices__list--dropdown .choices__item { font-size: 14.5px; }
.fs-country .choices__input { font-size: 14.5px; }

/* Flag before each country. Per-country background-image rules are generated in JS. */
.fs-country .choices__item--choice::before,
.fs-country .choices__list--single .choices__item::before {
  content: '';
  display: inline-block;
  width: 20px; height: 15px;
  margin-right: 10px;
  vertical-align: -2px;
  border-radius: 2px;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.fs-country .choices__item[data-value='']::before,
.fs-country .choices__placeholder::before { display: none; }

/* ---------- Done ---------- */
.fs-ring { display: block; width: 112px; height: 112px; margin: 0 auto 14px; }
.fs-ring-track { fill: none; stroke: var(--fs-border); stroke-width: 8; }
.fs-ring-arc {
  fill: none; stroke: var(--fs-primary); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 327; stroke-dashoffset: 327;
  transform: rotate(-90deg); transform-origin: 60px 60px;
  animation: fs-sweep 1.1s cubic-bezier(0.22, 0.8, 0.3, 1) 0.1s forwards;
}
.fs-ring-check {
  fill: none; stroke: var(--fs-navy); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 80; stroke-dashoffset: 80;
  animation: fs-draw 0.45s ease-out 0.95s forwards;
}
@keyframes fs-sweep { to { stroke-dashoffset: 0; } }
@keyframes fs-draw  { to { stroke-dashoffset: 0; } }

.fs-test {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #EEF3FF; color: var(--fs-navy);
  border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; font-weight: 600;
}

.fs-status { margin: 22px 0 0; text-align: left; border-top: 1px solid var(--fs-border); }
.fs-status > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--fs-border); }
.fs-status dt { font-weight: 500; color: var(--fs-muted); font-size: 14.5px; }
.fs-status dd { margin: 0; font-weight: 600; color: var(--fs-navy); text-align: right; font-size: 15px; }

.fs-badge { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; font-family: var(--fs-ui); }
.fs-badge--active   { background: #E7F5EC; color: #1E6B3B; }
.fs-badge--trialing { background: #E8F0FE; color: #1F4FB4; }
.fs-badge--past_due { background: #FFF2D9; color: #8A5A00; }
.fs-badge--canceled { background: #ECEEF3; color: #4A5163; }

/* ---------- Scan to open the app ---------- */
.fs-appqr {
  display: flex; align-items: center; gap: 28px;
  max-width: 560px; margin: 24px auto 0;
  background: #fff; border: 1px solid var(--fs-border); border-radius: 24px;
  padding: 24px;
}
.fs-appqr-code {
  position: relative; flex: none;
  width: 210px; height: 210px;
  background: #fff; border-radius: 12px;
  box-shadow: 0 0 0 1px var(--fs-border);
}
.fs-appqr-code svg { display: block; width: 100%; height: 100%; border-radius: 12px; }
.fs-appqr-code.is-expired svg { filter: blur(5px); opacity: 0.35; }
.fs-appqr-code.is-expired::after {
  content: 'Expired';
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--fs-ui); font-weight: 700; color: var(--fs-navy);
}
.fs-appqr-code:empty::before {
  content: ''; position: absolute; inset: 0; border-radius: 12px;
  background: linear-gradient(90deg, var(--fs-bg), #fff, var(--fs-bg));
}
.fs-appqr-body { min-width: 0; text-align: left; }
.fs-h3 { font-family: var(--fs-display); font-size: 19px; font-weight: 800; color: var(--fs-navy); margin: 0 0 6px; }
.fs-appqr-body p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.55; color: var(--fs-muted); }
.fs-appqr-body strong { color: var(--fs-navy); word-break: break-all; }
.fs-appqr-timer { font-family: var(--fs-ui); font-weight: 600; color: var(--fs-navy) !important; }
.fs-appqr-timer.is-expired { color: var(--fs-primary) !important; }
.fs-appqr .fs-fine { margin-top: 12px; font-size: 13px; }
/* On a phone you can't scan your own screen, so offer the link as a button. */
.fs-appqr-open { display: none !important; }
@media (max-width: 767.98px), (pointer: coarse) {
  .fs-appqr-open:not([hidden]) { display: inline-flex !important; justify-content: center; margin: 4px 0 10px; text-decoration: none; }
}

/* ---------- /app/login (link opened in a browser) ---------- */
.fs-applink-icon {
  display: inline-grid; place-items: center;
  width: 64px; height: 64px; margin-bottom: 16px;
  border-radius: 50%; background: var(--fs-soft); color: var(--fs-primary); font-size: 28px;
}
.fs-applink .fs-submit { display: flex; gap: 8px; align-items: center; text-decoration: none; }
.fs-applink-stores { display: grid; gap: 10px; margin-top: 12px; }
.fs-applink-steps { text-align: left; margin: 24px 0 0; padding-left: 20px; color: var(--fs-muted); font-size: 14.5px; line-height: 1.7; }

/* ---------- Small screens ---------- */
@media (max-width: 575.98px) {
  .fs-steps li:not(.is-active) .fs-step-label { display: none; }
  .fs-steps li + li::before { margin: 0 8px; }
  .fs-toolbar { justify-content: center; text-align: center; }
  .fs-currency { justify-content: center; }
  .fs-plan { padding: 28px 22px 24px; }
  .fs-appqr { flex-direction: column; text-align: center; }
  .fs-appqr-body { text-align: center; }
}

/* ---------- Respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .fs-ring-arc, .fs-ring-check { animation: none; stroke-dashoffset: 0; }
  .fs-loader { backdrop-filter: none; }
}
