/* ScriptFlare Account Pages — Shared CSS */

:root {
  --brand: #ff6b35;
  --brand-dark: #e55a26;
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #242424;
  --border: #2e2e2e;
  --text: #f0f0f0;
  --text-muted: #888;
  --success: #22c55e;
  --error: #ef4444;
  --pro: #a855f7;
  --autopilot: #3b82f6;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Auth Pages (login / signup) ── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo a {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brand);
  text-decoration: none;
}

.auth-logo span { color: var(--text); }

.auth-title {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 28px;
}

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s;
  outline: none;
}

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

.btn-auth {
  width: 100%;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}

.btn-auth:hover { background: var(--brand-dark); }
.btn-auth:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--error);
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: none;
}

.auth-error.visible { display: block; }

/* ── Account Dashboard ── */
.account-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.account-nav .logo a {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--brand);
  text-decoration: none;
}

.account-nav .logo span { color: var(--text); }

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

.tier-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tier-badge.free { background: rgba(136,136,136,0.15); color: #888; }
.tier-badge.pro { background: rgba(168,85,247,0.15); color: var(--pro); }
.tier-badge.autopilot { background: rgba(59,130,246,0.15); color: var(--autopilot); }

.btn-signout {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-signout:hover { color: var(--text); border-color: #444; }

.account-layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px;
}

.account-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-icon { font-size: 1.2rem; }

/* Upgrade cards */
.upgrade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) { .upgrade-grid { grid-template-columns: 1fr; } }

.upgrade-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  transition: border-color 0.2s;
}

.upgrade-card:hover { border-color: #555; }
.upgrade-card.pro-card { border-color: rgba(168,85,247,0.4); }
.upgrade-card.autopilot-card { border-color: rgba(59,130,246,0.4); }

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

.upgrade-card .plan-price {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 8px 0;
}

.upgrade-card .plan-price span {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-muted);
}

.upgrade-card ul {
  list-style: none;
  text-align: left;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 12px 0 16px;
  line-height: 2;
}

.upgrade-card ul li::before { content: '✓ '; color: var(--success); }

.btn-upgrade {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-upgrade:hover { opacity: 0.85; }
.btn-upgrade.pro { background: var(--pro); color: white; }
.btn-upgrade.autopilot { background: var(--autopilot); color: white; }

/* Autopilot config form */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) { .config-grid { grid-template-columns: 1fr; } }

.config-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.config-field input,
.config-field select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.config-field input:focus,
.config-field select:focus { border-color: var(--brand); }

.day-checkboxes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.day-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.day-checkbox input { display: none; }
.day-checkbox.checked { background: rgba(255,107,53,0.15); border-color: var(--brand); color: var(--brand); }

.btn-save {
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 16px;
}

.btn-save:hover { background: var(--brand-dark); }
.btn-save:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-run {
  background: var(--autopilot);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-left: 12px;
}

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

/* Enabled toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.toggle-label { font-weight: 600; font-size: 0.95rem; }
.toggle-desc { font-size: 0.82rem; color: var(--text-muted); }

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider { background: var(--autopilot); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }

/* Scripts table */
.scripts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.scripts-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.scripts-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.scripts-table tr:last-child td { border-bottom: none; }
.scripts-table tr:hover td { background: var(--surface2); }

.script-topic { font-weight: 600; max-width: 280px; }
.script-topic a { color: var(--brand); text-decoration: none; }
.script-topic a:hover { text-decoration: underline; }

.source-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
}

.source-badge.manual { background: rgba(136,136,136,0.15); color: #888; }
.source-badge.autopilot { background: rgba(59,130,246,0.15); color: var(--autopilot); }

.deliver-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.deliver-badge.notion { background: rgba(255,255,255,0.08); color: #ccc; }
.deliver-badge.pending { background: rgba(255,107,53,0.1); color: var(--brand); }

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

/* Notion setup */
.notion-setup {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.notion-setup .hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.notion-setup .hint a { color: var(--brand); }

.verify-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 16px;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.verify-btn:hover { border-color: #555; }

.verify-status {
  font-size: 0.85rem;
  padding: 6px 0;
}

.verify-status.ok { color: var(--success); }
.verify-status.err { color: var(--error); }

/* Locked overlay */
.locked-overlay {
  text-align: center;
  padding: 32px 20px;
}

.locked-overlay h3 { font-size: 1.1rem; margin-bottom: 8px; }
.locked-overlay p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 16px; }

.btn-locked {
  background: var(--autopilot);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 0.9rem;
  z-index: 1000;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s;
  max-width: 320px;
}

.toast-msg.show { transform: translateY(0); opacity: 1; }
.toast-msg.success { border-color: var(--success); color: var(--success); }
.toast-msg.error { border-color: var(--error); color: var(--error); }
