/* ── Reset & Variables ─────────────────────────────────────────────────────── */

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

:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --surface-hover: #222240;
  --primary: #7c4dff;
  --primary-light: #b388ff;
  --text: #e0e0e0;
  --text-muted: #9e9e9e;
  --text-dim: #6e6e8e;
  --border: #2a2a40;
  --popular-border: #7c4dff;
  --success: #4caf50;
  --error: #ef5350;
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1100px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ──────────────────────────────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 26, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.nav-logo:hover { text-decoration: none; color: var(--primary-light); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: #6a3de8; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); color: var(--text); }

.btn-large {
  width: 100%;
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: var(--radius);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: 64px 24px 32px;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
}

/* ── Toggle ───────────────────────────────────────────────────────────────── */

.toggle-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 auto 40px;
  background: var(--surface);
  border-radius: 999px;
  padding: 4px;
  width: fit-content;
}

.toggle-btn {
  padding: 8px 24px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-btn.active {
  background: var(--primary);
  color: #fff;
}

.toggle-save {
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 600;
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.toggle-save.visible { opacity: 1; }

/* ── Plans Grid ───────────────────────────────────────────────────────────── */

.plans-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

@media (max-width: 900px) {
  .plans-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .plans-grid { grid-template-columns: 1fr; max-width: 400px; }
  .hero h1 { font-size: 1.75rem; }
}

/* ── Plan Card ────────────────────────────────────────────────────────────── */

.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 0.2s, transform 0.2s;
}

.plan-card:hover {
  border-color: var(--text-dim);
  transform: translateY(-2px);
}

.plan-card--popular {
  border-color: var(--popular-border);
  box-shadow: 0 0 24px rgba(124, 77, 255, 0.15);
}

.plan-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 14px;
  border-radius: 999px;
}

.plan-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.plan-price {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 12px 0 4px;
}

.plan-price .currency {
  font-size: 1.25rem;
  vertical-align: top;
  margin-right: 2px;
}

.plan-period {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.plan-annual-total {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: -16px;
  margin-bottom: 20px;
}

.plan-features {
  list-style: none;
  margin-bottom: 24px;
  flex: 1;
}

.plan-features li {
  padding: 5px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-features li::before {
  content: '\2713';
  color: var(--success);
  font-weight: 700;
  font-size: 0.85rem;
}

/* ── Skeleton Loader ──────────────────────────────────────────────────────── */

.plan-card.skeleton {
  min-height: 360px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.3; }
}

/* ── Free Note ────────────────────────────────────────────────────────────── */

.free-note {
  text-align: center;
  padding: 40px 24px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

.footer {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-dim);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 60px;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  padding: 32px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

.modal h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 24px;
}

/* ── Auth Tabs ────────────────────────────────────────────────────────────── */

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.auth-tab.active {
  color: var(--primary-light);
  border-bottom-color: var(--primary);
}

/* ── Form ─────────────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus {
  border-color: var(--primary);
}

.form-error {
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 6px;
}

.form-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

.btn-google {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s;
}

.btn-google:hover { background: var(--surface-hover); }

.btn-google svg {
  width: 18px;
  height: 18px;
}

.forgot-link {
  display: block;
  text-align: right;
  font-size: 0.8rem;
  margin-top: -8px;
  margin-bottom: 16px;
}

/* ── Status Pages ─────────────────────────────────────────────────────────── */

.status-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
  padding: 24px;
}

.status-icon {
  font-size: 4rem;
  margin-bottom: 24px;
}

.status-page h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.status-page p {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 32px;
}

.status-actions {
  display: flex;
  gap: 12px;
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

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