/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; height: 100%; }
body {
  font-family: 'Inter', sans-serif;
  background: #0C1122;
  color: #e8eaf0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --navy:        #0C1122;
  --navy-mid:    #0f1627;
  --navy-card:   #151D32;
  --navy-light:  #1c2840;
  --navy-border: #1e2d47;
  --cyan:        #53DBF3;
  --cyan-soft:   rgba(83,219,243,.12);
  --cyan-hover:  #3ccee8;
  --white:       #F5F7FF;
  --off-white:   #A6B5CB;
  --muted:       #74869F;
  --border:      rgba(255,255,255,.07);
  --radius:      14px;
  --radius-sm:   8px;
  --transition:  0.2s ease;
  --danger:      #ef4444;
  --danger-soft: rgba(239,68,68,.12);
  --success:     #22c55e;
  --success-soft:rgba(34,197,94,.12);
  --warning:     #f59e0b;
  --warning-soft:rgba(245,158,11,.12);
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 48px;
  min-height: 100vh;
}

.page-wide {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.header {
  width: 100%;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--navy-mid);
}

.wordmark {
  font-family: 'DM Sans', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.02em;
}

.wordmark-period { color: var(--cyan); }

.header-link {
  font-size: 14px;
  color: var(--off-white);
  transition: color var(--transition);
}
.header-link:hover { color: var(--white); }

/* ── Card ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 440px;
}

.card-wide {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 580px;
}

.card-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 6px;
  line-height: 1.25;
}

.card-subtitle {
  font-size: 14px;
  color: var(--off-white);
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--navy-light);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 28px;
}

.tab-btn {
  flex: 1;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  transition: all var(--transition);
}
.tab-btn.active {
  background: var(--navy-card);
  color: var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.tab-btn:hover:not(.active) { color: var(--off-white); }

/* ── Form elements ─────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group:last-of-type { margin-bottom: 0; }

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--off-white);
  letter-spacing: 0.01em;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 15px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(83,219,243,.12);
}

input::placeholder { color: var(--muted); }

input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--cyan);
  color: #0C1122;
}
.btn-primary:hover:not(:disabled) {
  background: var(--cyan-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(83,219,243,.3);
}

.btn-secondary {
  background: var(--navy-light);
  color: var(--white);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--navy-border);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,.2);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239,68,68,.2);
}

.btn-ghost {
  background: transparent;
  color: var(--off-white);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--white); border-color: rgba(255,255,255,.15); }

.btn-full { width: 100%; }

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

/* ── Submit button with loading state ──────────────────────────────────────── */
.btn .spinner-inline {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ── Alerts / messages ─────────────────────────────────────────────────────── */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
  margin-top: 16px;
}

.alert-error {
  background: var(--danger-soft);
  border: 1px solid rgba(239,68,68,.25);
  color: #fca5a5;
}

.alert-success {
  background: var(--success-soft);
  border: 1px solid rgba(34,197,94,.25);
  color: #86efac;
}

.alert-info {
  background: var(--cyan-soft);
  border: 1px solid rgba(83,219,243,.2);
  color: var(--cyan);
}

.alert-warning {
  background: var(--warning-soft);
  border: 1px solid rgba(245,158,11,.25);
  color: #fcd34d;
}

.alert-hidden { display: none; }

/* ── Form footer links ─────────────────────────────────────────────────────── */
.form-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.form-footer a {
  color: var(--cyan);
  transition: color var(--transition);
}
.form-footer a:hover { color: var(--white); }

.form-actions {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Divider ───────────────────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 12px;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Page spinner (full-page loading) ──────────────────────────────────────── */
.page-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 60vh;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--navy-border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

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

/* ── Subscription dashboard ────────────────────────────────────────────────── */
.dashboard {
  flex: 1;
  padding: 32px 24px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

.dashboard-header {
  margin-bottom: 28px;
}

.dashboard-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 4px;
}

.dashboard-email {
  font-size: 14px;
  color: var(--muted);
}

/* ── Status badge ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-active {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(34,197,94,.2);
}

.badge-trialing {
  background: var(--cyan-soft);
  color: var(--cyan);
  border: 1px solid rgba(83,219,243,.2);
}

.badge-inactive {
  background: rgba(255,255,255,.05);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,.2);
}

/* ── Subscription card sections ────────────────────────────────────────────── */
.section {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.section-row + .section-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.row-label {
  font-size: 14px;
  color: var(--off-white);
}

.row-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  text-align: right;
}

/* ── Trial offer card ──────────────────────────────────────────────────────── */
.trial-card {
  background: linear-gradient(135deg, #0f1e38, #152840);
  border: 1px solid rgba(83,219,243,.2);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  margin-bottom: 16px;
}

.trial-price {
  font-family: 'DM Sans', sans-serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--white);
  margin: 12px 0 4px;
}

.trial-price-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}

.trial-feature-list {
  text-align: left;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trial-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--off-white);
}

.trial-feature::before {
  content: '✓';
  color: var(--cyan);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

/* ── Danger zone ───────────────────────────────────────────────────────────── */
.danger-zone {
  border-color: rgba(239,68,68,.2);
}

.danger-zone .section-title { color: #f87171; }

/* ── Confirm dialog (inline) ───────────────────────────────────────────────── */
.confirm-box {
  background: var(--danger-soft);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 12px;
  display: none;
}

.confirm-box.visible { display: block; }

.confirm-box p {
  font-size: 14px;
  color: #fca5a5;
  margin-bottom: 12px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Hidden helper ─────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .card { padding: 28px 20px; }
  .card-wide { padding: 24px 20px; }
  .dashboard { padding: 24px 16px; }
  .trial-card { padding: 24px 20px; }
  .trial-price { font-size: 30px; }
}
