/**
 * EQUITY INTELLIGENCE — 2-STEP TIER SUBSCRIPTION & PAYMENT STYLES
 * Codified according to UI_DESIGN_SYSTEM.md (Obsidian Canvas #0D0F14, 1px Hairlines, Inter)
 */

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --letter-spacing-base: -0.01em;
  --letter-spacing-tight: -0.02em;
  --letter-spacing-wide: 0.04em;

  --bg-canvas: #0D0F14;
  --bg-surface: #11141B;
  --bg-panel: #161A23;
  --bg-hover: rgba(255, 255, 255, 0.025);
  --bg-active: rgba(255, 255, 255, 0.06);

  --border-hairline: rgba(255, 255, 255, 0.045);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #ffffff;

  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #8E8E93;
  --text-dim: #64748b;

  --fin-positive: #10b981;
  --fin-positive-bg: rgba(16, 185, 129, 0.08);
  --fin-negative: #f43f5e;
  --fin-negative-bg: rgba(244, 63, 94, 0.08);
  --fin-warning: #f59e0b;
  --fin-warning-bg: rgba(245, 158, 11, 0.08);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-family);
  letter-spacing: var(--letter-spacing-base);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.subscribe-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.font-tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'cv05' 1, 'cv08' 1, 'tnum' 1;
}

/* ==========================================================================
   Top Utility Header
   ========================================================================== */
.subscribe-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-hairline);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
}

.header-left .brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-wordmark {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ffffff;
}

.btn-signout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease;
}

.btn-signout:hover {
  color: #ffffff;
  background: var(--bg-hover);
}

.header-progress-track {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
}

.header-progress-bar {
  height: 100%;
  background: #ffffff;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.header-progress-bar.step-1 {
  width: 50%;
}

.header-progress-bar.step-2 {
  width: 100%;
}

/* ==========================================================================
   Main Layout & Step Transition Container
   ========================================================================== */
.subscribe-main-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 80px 20px;
  width: 100%;
}

.checkout-step-panel {
  display: none;
  width: 100%;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.checkout-step-panel.step-active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.step-content-container {
  margin: 0 auto;
  width: 100%;
}

.tier-container-wide {
  max-width: 1080px;
}

.payment-container-focused {
  max-width: 540px;
}

/* ==========================================================================
   Typography & Header Blocks
   ========================================================================== */
.step-header-block {
  margin-bottom: 36px;
}

.text-center {
  text-align: center;
}

.eyebrow-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.main-heading {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: var(--letter-spacing-tight);
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 12px;
}

.subheading {
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 540px;
  margin: 0 auto;
}

/* ==========================================================================
   Billing Frequency Switcher
   ========================================================================== */
.billing-switcher-wrap {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 4px;
  margin-top: 24px;
  gap: 4px;
}

.billing-segment-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.18s ease;
}

.billing-segment-btn:hover {
  color: #ffffff;
}

.billing-segment-btn.active {
  background: #ffffff;
  color: #0D0F14;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.save-badge {
  background: rgba(16, 185, 129, 0.16);
  color: #10b981;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}

.billing-segment-btn.active .save-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #059669;
}

/* ==========================================================================
   Tier Cards Grid (Step 1)
   ========================================================================== */
.tier-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.tier-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 32px 26px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}

.tier-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: #141720;
}

.tier-card.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 1px #ffffff, 0 16px 40px rgba(0, 0, 0, 0.6);
  background: #141822;
}

.tier-card:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

.popular-pill-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  color: #0D0F14;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 12px;
  border-radius: 9999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.tier-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.tier-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.tier-audience {
  font-size: 12.5px;
  color: var(--text-muted);
}

.tier-selection-indicator {
  display: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  color: #0D0F14;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}

.tier-card.active .tier-selection-indicator {
  display: flex;
}

.tier-price-block {
  margin-bottom: 22px;
}

.price-figure-row {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.price-currency {
  font-size: 22px;
  font-weight: 600;
  color: #ffffff;
}

.price-amount {
  font-size: 40px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'cv05' 1, 'cv08' 1, 'tnum' 1;
}

.price-period {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-left: 4px;
}

.price-billed-subtext {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.tier-hairline-divider {
  height: 1px;
  background: var(--border-hairline);
  margin-bottom: 22px;
}

.tier-features-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.tier-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.4;
}

.feat-check {
  width: 16px;
  height: 16px;
  color: #ffffff;
  flex-shrink: 0;
  margin-top: 1px;
}

.tier-card.active .feat-check {
  color: var(--fin-positive);
}

.feat-content strong {
  display: block;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 1px;
}

.feat-content span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

/* ==========================================================================
   Primary Action Buttons & Footers
   ========================================================================== */
.step-action-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.btn-primary-action {
  background: #ffffff;
  color: #0D0F14;
  border: 1px solid #ffffff;
  border-radius: 9999px;
  font-family: var(--font-family);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 10px 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.16s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.btn-primary-action .arrow-icon {
  width: 14px;
  height: 14px;
  transition: transform 0.16s ease;
}

.btn-primary-action:hover {
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.btn-primary-action:hover .arrow-icon {
  transform: translateX(2px);
}

.btn-primary-action:active {
  transform: translateY(0);
}

.btn-primary-action.btn-submit-payment {
  width: 100%;
  padding: 13px 24px;
  font-size: 14px;
}

.btn-spinner {
  display: none;
  animation: spin 0.8s linear infinite;
}

.btn-primary-action.loading span,
.btn-primary-action.loading .arrow-icon {
  display: none;
}

.btn-primary-action.loading .btn-spinner {
  display: block;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Step 2: Payment Method Layout
   ========================================================================== */
.plan-review-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.review-plan-label {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 3px;
}

.review-plan-pricing {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.btn-change-plan {
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: opacity 0.16s ease;
}

.btn-change-plan:hover {
  opacity: 0.8;
}

/* ==========================================================================
   Authenticated User Badge
   ========================================================================== */
.auth-user-badge {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.auth-badge-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-badge-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #181d28;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
}

.auth-badge-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-badge-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.auth-badge-email {
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
}

.btn-auth-switch {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.btn-auth-switch:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.24);
  background: var(--bg-hover);
}

/* ==========================================================================
   Step Section Headers & Account Credentials Block
   ========================================================================== */
.block-step-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.block-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
}

.block-step-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.block-step-heading {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

.block-step-subheading {
  font-size: 12px;
  color: var(--text-muted);
}

.account-credentials-block,
.payment-details-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 24px;
}

.account-form-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.password-input-wrap .dark-input {
  padding-right: 42px;
}

.btn-toggle-pw {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: color 0.16s ease;
}

.btn-toggle-pw:hover {
  color: #ffffff;
}

/* ==========================================================================
   Checkout Trust Row
   ========================================================================== */
.checkout-trust-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.trust-item svg {
  color: #94a3b8;
}

.trust-dot {
  color: rgba(255, 255, 255, 0.18);
  font-size: 10px;
}

/* ==========================================================================
   Payment Accordion (Nested inside Payment Details Block)
   ========================================================================== */
.payment-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  margin-bottom: 0;
}

.accordion-item {
  background: #0D0F14;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.accordion-item.expanded {
  border-color: rgba(255, 255, 255, 0.24);
  background: #0F131D;
}

.accordion-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 18px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.card-network-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.network-badge {
  font-size: 10.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  letter-spacing: 0.04em;
}

.accordion-body {
  display: none;
  padding: 0 18px 20px 18px;
}

.accordion-item.expanded .accordion-body {
  display: block;
}

/* Form inputs */
.payment-fields-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.dark-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.dark-input {
  width: 100%;
  background: #0D0F14;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 14px;
  padding: 13px 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.dark-input:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 1px #ffffff;
}

.dark-input::placeholder {
  color: #555c68;
}

.card-number-wrap .dark-input {
  padding-right: 42px;
}

.card-brand-icon-slot {
  position: absolute;
  right: 12px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  pointer-events: none;
}

.cvv-tooltip-wrap {
  position: absolute;
  right: 12px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  cursor: help;
}

.field-validation-error {
  display: none;
  font-size: 12px;
  color: var(--fin-negative);
  margin-top: 4px;
  padding-left: 2px;
}

.form-group.has-error .dark-input {
  border-color: var(--fin-negative);
}

.form-group.has-error .field-validation-error {
  display: block;
}

.payment-terms-notice {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 6px 0 10px 0;
}

.payment-terms-notice a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-subtle);
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.payment-terms-notice a:hover {
  color: #ffffff;
  text-decoration-color: #ffffff;
}

.alt-payment-container {
  padding: 8px 0;
}

.alt-pay-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.btn-secondary-action {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 14.5px;
  font-weight: 600;
  padding: 14px 24px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.btn-secondary-action:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: #181d28;
}

.back-nav-wrap {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.btn-text-back {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.16s ease;
}

.btn-text-back:hover {
  color: #ffffff;
}

/* ==========================================================================
   External Footer
   ========================================================================== */
.subscribe-footer {
  border-top: 1px solid var(--border-hairline);
  padding: 32px 24px;
  background: var(--bg-canvas);
  margin-top: auto;
}

.footer-container {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.footer-links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.16s ease;
}

.footer-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */
@media (max-width: 860px) {
  .tier-cards-grid {
    grid-template-columns: 1fr;
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
  }

  .main-heading {
    font-size: 26px;
  }
}

/* Keyboard Accessibility — Swiss Monochrome :focus-visible */
:focus:not(:focus-visible) {
  outline: none;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: 1.5px solid rgba(255, 255, 255, 0.88);
  outline-offset: 2px;
}

input:not([type="checkbox"]):not([type="radio"]):focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 1.5px solid rgba(255, 255, 255, 0.85);
  outline-offset: 1px;
}

