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

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #ede9fe;
  --primary-dark-active: #312e81;
  --primary-dark-text: #a5b4fc;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --radius: 8px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --error-bg: #450a0a;
}

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

/* Navbar */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--text); }
.nav-links a.btn-primary { color: #fff; }
.nav-links a.btn-primary:hover { color: #fff; }

.btn-link {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0;
  transition: color 0.15s;
}
.btn-link:hover { color: var(--text); }

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background 0.15s, color 0.15s;
}

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

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-full { width: 100%; justify-content: center; }

/* Hero */
.hero {
  text-align: center;
  padding: 4rem 0 3rem;
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

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

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Feature cards */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
}

.feature-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.feature-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.875rem; color: var(--muted); }

/* Auth card */
.auth-card {
  max-width: 420px;
  margin: 2rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
}

.auth-card h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.form-group input {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s;
}

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

/* Alert */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid #fecaca;
}

/* Social auth */
.social-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.social-divider::before, .social-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.social-buttons { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.25rem; }

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s;
  border: 1px solid var(--border);
}
.btn-social:hover { opacity: 0.85; }

.btn-google { background: #fff; color: #3c4043; }
.btn-facebook { background: #1877F2; color: #fff; border-color: #1877F2; }

/* Auth footer */
.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 500; }

/* Utilities */
.text-center { text-align: center; }
.muted { color: var(--muted); margin-top: 0.5rem; }
.small { font-size: 0.85rem; }
.big-icon { font-size: 3rem; margin-bottom: 1rem; }

/* ── Pricing ────────────────────────────────────────────────────── */
.pricing-header { text-align: center; padding: 3rem 0 2rem; }
.pricing-header h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 0.5rem; }
.pricing-header p { color: var(--muted); }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 700px;
  margin: 0 auto 3rem;
}

.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  position: relative;
}

.pricing-card--featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.9rem;
  border-radius: 99px;
  white-space: nowrap;
}

.pricing-name { font-weight: 700; font-size: 1.1rem; margin-bottom: 1rem; }

.pricing-price { margin-bottom: 1.5rem; }
.pricing-amount { font-size: 2.5rem; font-weight: 800; }
.pricing-period { color: var(--muted); font-size: 0.9rem; }

.pricing-features {
  list-style: none;
  margin-bottom: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.pricing-features li { font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem; }
.check { color: #16a34a; font-weight: 700; }

.checkbox-label { display:flex; align-items:center; gap:0.4rem; font-size:0.9rem; cursor:pointer; }
.checkbox-label input[type="checkbox"] { width:16px; height:16px; cursor:pointer; accent-color: var(--primary); }

.form-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.form-group select, .form-group textarea {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
}
.form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }
.field-hint { font-size: 0.78rem; color: var(--muted); margin-top: 0.3rem; display: block; }

/* ── Admin panel ───────────────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.admin-sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.sidebar-brand a { color: var(--muted); text-decoration: none; font-size: 0.875rem; }
.sidebar-brand a:hover { color: var(--text); }

.sidebar-nav { padding: 1rem 0.75rem; flex: 1; }
.sidebar-section { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0 0.75rem; margin-bottom: 0.4rem; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover { background: var(--bg); color: var(--text); }
.sidebar-link.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }

.sidebar-user {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-main {
  flex: 1;
  padding: 2rem;
  overflow-x: auto;
}

.admin-header {
  margin-bottom: 1.75rem;
}
.admin-header h1 { font-size: 1.5rem; font-weight: 700; }
.back-link { display: inline-block; color: var(--muted); text-decoration: none; font-size: 0.875rem; margin-bottom: 0.5rem; }
.back-link:hover { color: var(--text); }

.stat-cards {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 120px;
}
.stat-number { font-size: 1.75rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--muted); }

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 1.25rem; }

.table-toolbar { margin-bottom: 1rem; }
.search-form { display: flex; gap: 0.5rem; align-items: center; }
.search-input {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--bg);
  width: 260px;
}
.search-input:focus { outline: none; border-color: var(--primary); }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th { text-align: left; padding: 0.6rem 0.75rem; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
.data-table td { padding: 0.75rem 0.75rem; border-bottom: 1px solid var(--border); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg); }
.empty-row { text-align: center; color: var(--muted); padding: 2rem; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 1.25rem 0 0.25rem; }
.pagination-info { font-size: 0.875rem; color: var(--muted); }
.btn.disabled { opacity: 0.4; pointer-events: none; }

/* Badges */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 99px; font-size: 0.75rem; font-weight: 500; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-gray { background: var(--border); color: var(--muted); }
.badge-purple { background: var(--primary-light); color: var(--primary); }
.badge-red { background: #fef2f2; color: var(--error); }

/* Buttons extra */
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 0.35rem 0.9rem; font-size: 0.8rem; }

/* Detail */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.detail-list { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.5rem; font-size: 0.875rem; }
.detail-list dt { color: var(--muted); font-weight: 500; }

.action-row { display: flex; align-items: center; justify-content: space-between; }
.action-label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.35rem; }

.danger-zone { border-color: #fecaca; }
.danger-title { color: var(--error); }

/* Dashboard */
.dashboard { max-width: 700px; }

.dashboard-header {
  margin-bottom: 2rem;
}

.dashboard-header h2 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.dashboard-header p { color: var(--muted); }

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.info-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.info-value { font-weight: 600; font-size: 1rem; }

/* ── Dark mode toggle ──────────────────────────────────────────── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.3rem 0.6rem;
  color: var(--muted);
  transition: border-color 0.15s, color 0.15s;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* Dark mode overrides */
[data-theme="dark"] .btn-google { background: #1e293b; color: #f1f5f9; border-color: #334155; }
[data-theme="dark"] .sidebar-link.active { background: var(--primary-dark-active); color: var(--primary-dark-text); }
[data-theme="dark"] .badge-green { background: #14532d; color: #86efac; }
[data-theme="dark"] .badge-gray { background: #334155; color: #94a3b8; }
[data-theme="dark"] .badge-purple { background: var(--primary-dark-active); color: var(--primary-dark-text); }
[data-theme="dark"] .badge-red { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .alert-error { background: #450a0a; border-color: #7f1d1d; }
[data-theme="dark"] .alert-success { background: #14532d; border-color: #166534; color: #86efac; }
[data-theme="dark"] .data-table tbody tr:hover { background: #0f172a; }
[data-theme="dark"] code { background: #334155; color: #e2e8f0; }

/* ── Legal page ────────────────────────────────────────────────── */
.legal-page { max-width: 720px; margin: 0 auto; }
.legal-page h1 { font-size: 2rem; font-weight: 700; margin-bottom: 2rem; }
.legal-content { line-height: 1.8; }
.legal-content h2 { font-size: 1.3rem; font-weight: 600; margin: 2rem 0 0.75rem; }
.legal-content h3 { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.legal-content p { margin-bottom: 1rem; color: var(--text); }
.legal-content ul { padding-left: 1.5rem; margin-bottom: 1rem; }
.legal-content li { margin-bottom: 0.4rem; }

/* ── Alert success (public) ────────────────────────────────────── */
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* ── Palette picker ────────────────────────────────────────────── */
.palette-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.4rem;
}
.palette-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}
.palette-option input[type="radio"] { display: none; }
.palette-swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.palette-check {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.15s;
}
.palette-option input:checked + .palette-swatch {
  border-color: var(--text);
  transform: scale(1.12);
}
.palette-option input:checked + .palette-swatch .palette-check { opacity: 1; }
.palette-name { font-size: 0.75rem; color: var(--muted); }

/* ── Responsive ────────────────────────────────────────────────── */

/* Hamburger button (hidden on desktop) */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  z-index: 201;
}
.nav-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Overlay (mobile nav + admin sidebar) */
.nav-overlay, .sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
.nav-overlay.open, .sidebar-overlay.open { display: block; }

/* Admin mobile top bar */
.admin-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-topbar-brand { font-weight: 600; font-size: 0.95rem; color: var(--text); text-decoration: none; }

@media (max-width: 768px) {

  /* ── Navbar ── */
  .navbar { padding: 0 1rem; z-index: 200; }
  .nav-burger { display: flex; }

  .nav-links {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.5rem 1.5rem;
    gap: 0;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a, .btn-link {
    display: block;
    width: 100%;
    padding: 0.7rem 0;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
  }
  .nav-links li:last-child a,
  .nav-links li:last-child .btn-link,
  .nav-links li:last-child button { border-bottom: none; }
  .nav-links .btn.btn-primary {
    display: inline-flex;
    width: auto;
    margin-top: 0.5rem;
  }
  .theme-toggle { margin-top: 0.5rem; }

  /* ── Container ── */
  .container { padding: 1.5rem 1rem; }

  /* ── Hero ── */
  .hero { padding: 2rem 0 1.5rem; }
  .hero h1 { font-size: 1.9rem; }
  .hero p { font-size: 1rem; }

  /* ── Auth ── */
  .auth-card { padding: 1.5rem 1.25rem; margin: 1rem auto; }

  /* ── Forms ── */
  .form-row { grid-template-columns: 1fr; }
  .search-form { flex-wrap: wrap; }
  .search-input { width: 100%; }

  /* ── Dashboard ── */
  .dashboard { max-width: 100%; }
  .dashboard-header h2 { font-size: 1.4rem; }
  .dashboard-cards { grid-template-columns: 1fr 1fr; }

  /* ── Pricing ── */
  .pricing-grid { grid-template-columns: 1fr; max-width: 420px; }
  .pricing-header h1 { font-size: 1.75rem; }

  /* ── Detail grid ── */
  .detail-grid { grid-template-columns: 1fr; }

  /* ── Admin layout ── */
  .admin-topbar { display: flex; }
  .admin-layout { flex-direction: column; }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    min-height: 100dvh;
    width: 260px;
  }
  .admin-sidebar.open { transform: translateX(0); }

  .admin-main { padding: 1.25rem 1rem; }
  .admin-header { margin-bottom: 1.25rem; }

  /* ── Tables: horizontal scroll ── */
  .admin-card { overflow-x: auto; }
  .data-table { min-width: 520px; }

  /* ── Stat cards ── */
  .stat-cards { gap: 0.75rem; }
  .stat-card { padding: 1rem 1.25rem; min-width: 100px; }
  .stat-number { font-size: 1.4rem; }

  /* ── Admin header row ── */
  .admin-header[style*="justify-content:space-between"] {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.6rem; }
  .auth-card { padding: 1.25rem 1rem; }
  .dashboard-cards { grid-template-columns: 1fr; }
  .btn-full { font-size: 1rem; padding: 0.75rem 1rem; }
}
