/* =========================================================
   Click2ProfitAI — Design System
   ========================================================= */

/* ----- Google Fonts import ----- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* =========================================================
   CSS Custom Properties
   ========================================================= */
:root {
  /* Brand palette */
  --primary:        #6366f1;
  --primary-dark:   #4f46e5;
  --primary-light:  #818cf8;
  --secondary:      #8b5cf6;
  --accent:         #f59e0b;
  --accent-dark:    #d97706;

  /* Status */
  --success:  #10b981;
  --danger:   #ef4444;
  --warning:  #f59e0b;
  --info:     #3b82f6;

  /* Gradients */
  --grad-primary:   linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --grad-hero:      linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  --grad-accent:    linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --grad-success:   linear-gradient(135deg, #10b981 0%, #059669 100%);
  --grad-card:      linear-gradient(145deg, rgba(99,102,241,.08) 0%, rgba(139,92,246,.05) 100%);

  /* Dark theme (sidebar + auth) */
  --dark-bg:        #0f172a;
  --dark-surface:   #1e293b;
  --dark-border:    #334155;
  --dark-text:      #f1f5f9;
  --dark-muted:     #94a3b8;

  /* Light theme (main content) */
  --light-bg:       #f8fafc;
  --light-surface:  #ffffff;
  --light-border:   #e2e8f0;
  --light-text:     #1e293b;
  --light-muted:    #64748b;

  /* Sidebar */
  --sidebar-w:      260px;
  --sidebar-w-sm:   72px;

  /* Shadows */
  --shadow-xs:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-sm:  0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-md:  0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --shadow-lg:  0 20px 25px -5px rgba(0,0,0,.12), 0 10px 10px -5px rgba(0,0,0,.06);
  --shadow-xl:  0 25px 50px -12px rgba(0,0,0,.25);
  --shadow-glow: 0 0 40px rgba(99,102,241,.25);
  --shadow-card: 0 4px 24px rgba(0,0,0,.06);

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Transitions */
  --t-fast:   0.15s ease;
  --t-base:   0.25s ease;
  --t-slow:   0.4s ease;

  /* Typography */
  --font-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* =========================================================
   Reset & Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-base);
  background: var(--light-bg);
  color: var(--light-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a  { color: var(--primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--primary-dark); }
ul { list-style: none; }

/* Custom scrollbar */
::-webkit-scrollbar         { width: 6px; height: 6px; }
::-webkit-scrollbar-track   { background: transparent; }
::-webkit-scrollbar-thumb   { background: #cbd5e1; border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* =========================================================
   Typography
   ========================================================= */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

.gradient-text {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.accent-text {
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* =========================================================
   Utility Classes
   ========================================================= */
.container     { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm  { max-width: 720px; }
.container-lg  { max-width: 1400px; }

.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-col      { display: flex; flex-direction: column; }
.gap-1         { gap: .5rem; }
.gap-2         { gap: 1rem; }
.gap-3         { gap: 1.5rem; }
.gap-4         { gap: 2rem; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 2rem; }

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--light-muted); }
.text-small   { font-size: .875rem; }
.text-xs      { font-size: .75rem; }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }

.hidden       { display: none !important; }
.sr-only      { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .625rem 1.375rem;
  font-size: .9375rem;
  font-weight: 600;
  font-family: var(--font-base);
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--t-base);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--t-fast);
}
.btn:hover::after { background: rgba(255,255,255,.08); }
.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99,102,241,.4);
}
.btn-primary:hover {
  color: #fff;
  box-shadow: 0 8px 25px rgba(99,102,241,.55);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: 0 4px 15px rgba(245,158,11,.4);
}
.btn-accent:hover {
  color: #fff;
  box-shadow: 0 8px 25px rgba(245,158,11,.55);
  transform: translateY(-1px);
}

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

.btn-ghost {
  background: rgba(99,102,241,.08);
  color: var(--primary);
  border-color: transparent;
}
.btn-ghost:hover { background: rgba(99,102,241,.16); color: var(--primary); }

.btn-dark {
  background: var(--dark-surface);
  color: var(--dark-text);
  border-color: var(--dark-border);
}
.btn-dark:hover { background: #2d3f5a; color: #fff; }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; color: #fff; transform: translateY(-1px); }

.btn-sm { padding: .4rem .875rem; font-size: .8125rem; border-radius: var(--radius-sm); }
.btn-lg { padding: .875rem 2rem; font-size: 1.0625rem; border-radius: var(--radius-lg); }
.btn-xl { padding: 1rem 2.5rem; font-size: 1.125rem; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }

.btn-icon {
  width: 38px; height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* =========================================================
   Cards
   ========================================================= */
.card {
  background: var(--light-surface);
  border: 1px solid var(--light-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.card-body   { padding: 1.5rem; }
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--light-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--light-border);
  background: rgba(248,250,252,.8);
}

.card-hover {
  transition: transform var(--t-base), box-shadow var(--t-base);
  cursor: pointer;
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Glass card */
.card-glass {
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius-lg);
}

/* Gradient border card */
.card-gradient-border {
  position: relative;
  background: var(--light-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1.5px;
  background: var(--grad-primary);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  border-radius: inherit;
}

/* =========================================================
   Stat Cards (Dashboard)
   ========================================================= */
.stat-card {
  background: var(--light-surface);
  border: 1px solid var(--light-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow-xs);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  flex-shrink: 0;
}
.stat-icon.purple  { background: rgba(99,102,241,.12);  color: var(--primary); }
.stat-icon.violet  { background: rgba(139,92,246,.12); color: var(--secondary); }
.stat-icon.amber   { background: rgba(245,158,11,.12); color: var(--accent); }
.stat-icon.green   { background: rgba(16,185,129,.12); color: var(--success); }
.stat-icon.red     { background: rgba(239,68,68,.12);  color: var(--danger); }
.stat-icon.blue    { background: rgba(59,130,246,.12); color: var(--info); }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: .8rem; font-weight: 500; color: var(--light-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .25rem; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--light-text); line-height: 1; }
.stat-sub   { font-size: .8rem; color: var(--light-muted); margin-top: .25rem; }

/* =========================================================
   Forms
   ========================================================= */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--light-text);
  margin-bottom: .45rem;
}
.form-label span.req { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: .6875rem 1rem;
  font-size: .9375rem;
  font-family: var(--font-base);
  color: var(--light-text);
  background: var(--light-surface);
  border: 1.5px solid var(--light-border);
  border-radius: var(--radius-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
  line-height: 1.5;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-control::placeholder { color: #b0bec5; }
.form-control.is-invalid   { border-color: var(--danger); }
.form-control.is-valid     { border-color: var(--success); }

textarea.form-control { resize: vertical; min-height: 100px; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-hint  { font-size: .8rem; color: var(--light-muted); margin-top: .35rem; }
.form-error { font-size: .8rem; color: var(--danger); margin-top: .35rem; display: flex; align-items: center; gap: .3rem; }

/* Input with icon */
.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-left: 2.75rem; }
.input-icon-wrap .input-icon {
  position: absolute; left: .875rem; top: 50%; transform: translateY(-50%);
  color: var(--light-muted); font-size: 1rem; pointer-events: none;
}

/* Toggle chips (tone selector) */
.chip-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip-input  { display: none; }
.chip-label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .875rem;
  border: 1.5px solid var(--light-border);
  border-radius: var(--radius-full);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  color: var(--light-muted);
  background: var(--light-surface);
  user-select: none;
}
.chip-label:hover { border-color: var(--primary); color: var(--primary); }
.chip-input:checked + .chip-label {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(99,102,241,.35);
}

/* Word count pills (new length selector) */
.wc-pill {
  padding: .35rem .875rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--light-border);
  background: #fff;
  font-size: .8rem;
  font-weight: 600;
  color: var(--light-muted);
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: inherit;
}
.wc-pill:hover  { border-color: var(--primary); color: var(--primary); }
.wc-pill.active { border-color: var(--primary); color: var(--primary); background: rgba(99,102,241,.07); }

/* Word count buttons (legacy, kept for compatibility) */
.wc-group { display: flex; gap: .5rem; flex-wrap: wrap; }
.wc-input  { display: none; }
.wc-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  padding: .5rem .875rem;
  border: 1.5px solid var(--light-border);
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  color: var(--light-muted);
  background: var(--light-surface);
  user-select: none;
}
.wc-label:hover { border-color: var(--primary); color: var(--primary); }
.wc-input:checked + .wc-label {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(99,102,241,.35);
}

/* Credit cost badge */
.credit-cost {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  background: rgba(245,158,11,.1);
  color: var(--accent-dark);
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 700;
}

/* =========================================================
   Alerts / Toasts
   ========================================================= */
.alert {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: .9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}
.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .1rem; }
.alert-success { background: rgba(16,185,129,.1); color: #065f46; border: 1px solid rgba(16,185,129,.25); }
.alert-danger  { background: rgba(239,68,68,.1);  color: #7f1d1d; border: 1px solid rgba(239,68,68,.25); }
.alert-warning { background: rgba(245,158,11,.1); color: #78350f; border: 1px solid rgba(245,158,11,.25); }
.alert-info    { background: rgba(59,130,246,.1); color: #1e3a5f; border: 1px solid rgba(59,130,246,.25); }

/* Toast notification */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9999;
  display: flex; flex-direction: column; gap: .5rem;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: .75rem;
  padding: .875rem 1.25rem;
  background: var(--dark-surface);
  color: var(--dark-text);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  font-size: .9rem;
  font-weight: 500;
  min-width: 280px;
  pointer-events: all;
  border-left: 3px solid var(--primary);
  animation: toastIn .3s ease forwards;
  max-width: 360px;
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-danger  { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.fade-out      { animation: toastOut .3s ease forwards; }

@keyframes toastIn  { from { opacity:0; transform: translateX(60px); } to { opacity:1; transform: translateX(0); } }
@keyframes toastOut { from { opacity:1; transform: translateX(0); } to { opacity:0; transform: translateX(60px); } }

/* =========================================================
   Badges
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: var(--radius-full);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-purple  { background: rgba(99,102,241,.12);  color: var(--primary); }
.badge-green   { background: rgba(16,185,129,.12);  color: var(--success); }
.badge-red     { background: rgba(239,68,68,.12);   color: var(--danger);  }
.badge-amber   { background: rgba(245,158,11,.12);  color: var(--accent-dark); }
.badge-gray    { background: rgba(100,116,139,.1);  color: var(--light-muted); }

/* Plan badges */
.plan-badge {
  display: inline-flex; align-items: center;
  padding: .2rem .65rem;
  border-radius: var(--radius-full);
  font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.badge-basic     { background: rgba(100,116,139,.1);  color: #475569; }
.badge-pro       { background: rgba(99,102,241,.12);  color: var(--primary); }
.badge-unlimited { background: var(--grad-accent);    color: #fff; }

/* =========================================================
   Page Header (app pages)
   ========================================================= */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.page-title { font-size: 1.625rem; font-weight: 800; color: var(--light-text); margin-bottom: .25rem; }
.page-subtitle { font-size: .9rem; color: var(--light-muted); }

/* =========================================================
   Sidebar Layout
   ========================================================= */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--dark-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
  transition: transform var(--t-base), width var(--t-base);
  border-right: 1px solid var(--dark-border);
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid var(--dark-border);
}
.sidebar-logo-icon {
  width: 38px; height: 38px;
  background: var(--grad-primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,.4);
}
.sidebar-logo-text { color: #fff; font-size: 1rem; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.sidebar-logo-text span { color: var(--primary-light); }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.sidebar-section-label {
  padding: .75rem 1.25rem .25rem;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dark-muted);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.25rem;
  color: var(--dark-muted);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--t-fast);
  border-radius: 0;
  position: relative;
  margin: .1rem .5rem;
  border-radius: var(--radius-md);
}
.sidebar-link i { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-link span { white-space: nowrap; overflow: hidden; }
.sidebar-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-link.active {
  background: rgba(99,102,241,.18);
  color: var(--primary-light);
  font-weight: 600;
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--grad-primary);
  border-radius: 0 3px 3px 0;
  margin-left: -.5rem;
}

/* Sidebar credit widget */
.sidebar-credits {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--dark-border);
}
.credits-widget {
  background: rgba(99,102,241,.12);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: var(--radius-md);
  padding: .875rem 1rem;
}
.credits-label  { font-size: .7rem; font-weight: 600; color: var(--dark-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .25rem; }
.credits-count  { font-size: 1.5rem; font-weight: 800; color: #fff; line-height: 1; margin-bottom: .5rem; }
.credits-count span { font-size: .75rem; font-weight: 500; color: var(--dark-muted); }
.credits-bar    { height: 4px; background: rgba(255,255,255,.1); border-radius: var(--radius-full); overflow: hidden; }
.credits-bar-fill { height: 100%; background: var(--grad-primary); border-radius: var(--radius-full); transition: width .6s ease; }

/* Sidebar user */
.sidebar-user {
  padding: .875rem 1.25rem;
  border-top: 1px solid var(--dark-border);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}
.user-name  { font-size: .85rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: .72rem; color: var(--dark-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main content area */
.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--t-base);
}

/* Top bar */
.topbar {
  height: 64px;
  background: var(--light-surface);
  border-bottom: 1px solid var(--light-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1rem;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-right { display: flex; align-items: center; gap: .75rem; }

.hamburger {
  display: none;
  width: 38px; height: 38px;
  border: none;
  background: rgba(99,102,241,.08);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background var(--t-fast);
}
.hamburger:hover { background: rgba(99,102,241,.15); }
.hamburger span { display: block; width: 18px; height: 2px; background: var(--primary); border-radius: 2px; }

.topbar-breadcrumb { font-size: .875rem; color: var(--light-muted); display: flex; align-items: center; gap: .5rem; }
.topbar-breadcrumb strong { color: var(--light-text); }

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* Main content wrapper */
.page-content { flex: 1; padding: 2rem 1.75rem; }

/* =========================================================
   Landing Page — Navbar
   ========================================================= */
.landing-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  padding: 1rem 0;
  transition: all .3s ease;
}
.landing-nav.scrolled {
  background: rgba(15,23,42,.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: .6rem 0;
  box-shadow: 0 4px 30px rgba(0,0,0,.3);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
}
.nav-logo-icon {
  width: 40px; height: 40px;
  background: var(--grad-primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 15px rgba(99,102,241,.4);
}
.nav-logo-text { font-size: 1.125rem; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.nav-logo-text span { color: var(--primary-light); }

.nav-links { display: flex; align-items: center; gap: .25rem; }
.nav-link {
  padding: .5rem .875rem;
  color: rgba(255,255,255,.75);
  font-size: .9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--t-fast);
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }

.nav-actions { display: flex; align-items: center; gap: .75rem; }
.nav-mobile-btn { display: none; }

/* =========================================================
   Landing Page — Hero
   ========================================================= */
.hero {
  min-height: 100vh;
  background: var(--grad-hero);
  display: flex;
  align-items: center;
  padding: 7rem 0 4rem;
  position: relative;
  overflow: hidden;
}

/* Animated orbs */
.hero::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,.2) 0%, transparent 70%);
  animation: float 8s ease-in-out infinite;
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(139,92,246,.15) 0%, transparent 70%);
  animation: float 10s ease-in-out infinite reverse;
  pointer-events: none;
}

@keyframes float {
  0%,100% { transform: translate(0,0) scale(1); }
  50%      { transform: translate(30px,-30px) scale(1.05); }
}

/* Grid pattern overlay */
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(99,102,241,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,.07) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; max-width: 700px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: rgba(99,102,241,.15);
  border: 1px solid rgba(99,102,241,.3);
  color: var(--primary-light);
  padding: .4rem 1rem;
  border-radius: var(--radius-full);
  font-size: .8125rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(8px);
}
.hero-badge .dot {
  width: 7px; height: 7px;
  background: var(--primary-light);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity:1; transform: scale(1); }
  50%      { opacity:.5; transform: scale(1.3); }
}

.hero h1 { color: #fff; margin-bottom: 1.25rem; }
.hero p  { font-size: 1.1875rem; color: rgba(255,255,255,.7); margin-bottom: 2rem; line-height: 1.7; max-width: 560px; }

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

.hero-stats {
  display: flex;
  gap: 2.5rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}
.hero-stat-num  { font-size: 2rem; font-weight: 800; color: #fff; }
.hero-stat-label { font-size: .8125rem; color: rgba(255,255,255,.55); margin-top: .1rem; }

/* Hero mockup */
.hero-visual {
  position: relative;
  z-index: 1;
}
.hero-mockup {
  background: rgba(30,41,59,.9);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  backdrop-filter: blur(20px);
  box-shadow: 0 40px 80px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.05);
  max-width: 500px;
  margin-left: auto;
}
.mockup-topbar {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.mockup-dot { width: 10px; height: 10px; border-radius: 50%; }
.mockup-dot:nth-child(1) { background: #ef4444; }
.mockup-dot:nth-child(2) { background: #f59e0b; }
.mockup-dot:nth-child(3) { background: #10b981; }
.mockup-topbar span { margin-left: auto; font-size: .75rem; color: rgba(255,255,255,.3); }

.mockup-field {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-md);
  padding: .75rem 1rem;
  margin-bottom: .75rem;
  font-size: .85rem;
  color: rgba(255,255,255,.7);
}
.mockup-field-label { font-size: .7rem; color: rgba(255,255,255,.4); margin-bottom: .25rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.mockup-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.mockup-chip  { padding: .25rem .65rem; border-radius: var(--radius-full); font-size: .7rem; font-weight: 600; }
.mockup-chip.active { background: var(--primary); color: #fff; }
.mockup-chip.inactive { background: rgba(255,255,255,.06); color: rgba(255,255,255,.4); }
.mockup-generate {
  background: var(--grad-primary);
  border-radius: var(--radius-md);
  padding: .75rem;
  text-align: center;
  color: #fff;
  font-weight: 600;
  font-size: .875rem;
  margin-top: .75rem;
  box-shadow: 0 4px 15px rgba(99,102,241,.5);
}
.mockup-output {
  margin-top: .75rem;
  background: rgba(16,185,129,.08);
  border: 1px solid rgba(16,185,129,.2);
  border-radius: var(--radius-md);
  padding: .875rem 1rem;
  font-size: .75rem;
  color: rgba(255,255,255,.7);
  line-height: 1.6;
}
.mockup-output strong { color: #6ee7b7; font-size: .8rem; }

/* =========================================================
   Section Styles (Landing)
   ========================================================= */
.section { padding: 5rem 0; }
.section-dark { background: var(--dark-bg); }
.section-gray { background: #f1f5f9; }

.section-label {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: .75rem;
}
.section-title { margin-bottom: 1rem; }
.section-desc  { font-size: 1.0625rem; color: var(--light-muted); max-width: 580px; line-height: 1.7; }

/* =========================================================
   Feature Cards (Landing)
   ========================================================= */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; margin-top: 3rem; }

.feature-card {
  background: var(--light-surface);
  border: 1px solid var(--light-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
}
.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--grad-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-base);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature-card:hover::before { transform: scaleX(1); }

.feature-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  background: rgba(99,102,241,.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1.25rem;
  transition: background var(--t-base);
}
.feature-card:hover .feature-icon { background: var(--grad-primary); color: #fff; }
.feature-card h3  { font-size: 1.0625rem; margin-bottom: .5rem; }
.feature-card p   { font-size: .9rem; color: var(--light-muted); line-height: 1.6; }

/* =========================================================
   How It Works
   ========================================================= */
.steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 2rem; margin-top: 3rem; position: relative; }
.steps::before {
  content: '';
  position: absolute;
  top: 2rem; left: calc(16% + 2rem); right: calc(16% + 2rem);
  height: 2px;
  background: var(--light-border);
  z-index: 0;
}

.step {
  text-align: center;
  position: relative;
  z-index: 1;
}
.step-num {
  width: 60px; height: 60px;
  border-radius: var(--radius-full);
  background: var(--grad-primary);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.25rem;
  box-shadow: 0 8px 24px rgba(99,102,241,.4);
}
.step h3 { font-size: 1rem; margin-bottom: .5rem; }
.step p  { font-size: .875rem; color: var(--light-muted); line-height: 1.6; }

/* =========================================================
   Pricing / Plan Cards
   ========================================================= */
.plan-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; margin-top: 3rem; }

.plan-card {
  background: var(--light-surface);
  border: 2px solid var(--light-border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
}
.plan-card.featured {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}
.plan-card.featured::before {
  content: 'MOST POPULAR';
  position: absolute;
  top: 1rem; right: -2rem;
  background: var(--grad-primary);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  padding: .3rem 3rem;
  transform: rotate(45deg);
  transform-origin: center;
  top: 1.5rem; right: -1.25rem;
}
.plan-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-xl); }

.plan-name    { font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); margin-bottom: .5rem; }
.plan-credits { font-size: 2.5rem; font-weight: 900; color: var(--light-text); line-height: 1; margin-bottom: .25rem; }
.plan-credits span { font-size: 1rem; font-weight: 500; color: var(--light-muted); }
.plan-price   { font-size: .9rem; color: var(--light-muted); margin-bottom: 1.5rem; }

.plan-features { margin-bottom: 1.75rem; }
.plan-feature {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .4rem 0;
  font-size: .875rem;
  color: var(--light-text);
  border-bottom: 1px solid var(--light-border);
}
.plan-feature:last-child { border-bottom: none; }
.plan-feature i { color: var(--success); font-size: .9rem; }

/* =========================================================
   Testimonials
   ========================================================= */
.testimonial-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; margin-top: 3rem; }

.testimonial {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}
.testimonial-stars { color: #fbbf24; font-size: 1rem; letter-spacing: .1em; margin-bottom: .875rem; }
.testimonial-text  { color: rgba(255,255,255,.8); font-size: .9375rem; line-height: 1.7; margin-bottom: 1.25rem; font-style: italic; }
.testimonial-author { display: flex; align-items: center; gap: .75rem; }
.testimonial-avatar {
  width: 36px; height: 36px; border-radius: var(--radius-full);
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .8rem;
}
.testimonial-name  { font-size: .875rem; font-weight: 600; color: #fff; }
.testimonial-role  { font-size: .75rem; color: rgba(255,255,255,.45); }

/* =========================================================
   Footer (Landing)
   ========================================================= */
.landing-footer {
  background: var(--dark-bg);
  border-top: 1px solid var(--dark-border);
  padding: 3rem 0 1.5rem;
}
.footer-top { display: flex; justify-content: space-between; gap: 3rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
.footer-brand { max-width: 280px; }
.footer-brand p { font-size: .875rem; color: var(--dark-muted); line-height: 1.7; margin-top: .75rem; }
.footer-col h4 { font-size: .875rem; font-weight: 700; color: #fff; margin-bottom: .875rem; }
.footer-col a  { display: block; font-size: .85rem; color: var(--dark-muted); padding: .25rem 0; transition: color var(--t-fast); }
.footer-col a:hover { color: var(--primary-light); }
.footer-bottom {
  border-top: 1px solid var(--dark-border);
  padding-top: 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
  font-size: .8rem; color: var(--dark-muted);
}

/* =========================================================
   Auth Pages
   ========================================================= */
.auth-wrapper {
  min-height: 100vh;
  background: var(--grad-hero);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  position: relative;
  overflow: hidden;
}
.auth-wrapper::before {
  content: '';
  position: absolute;
  top: -30%; right: -10%;
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(99,102,241,.15) 0%, transparent 65%);
  pointer-events: none;
}
.auth-wrapper::after {
  content: '';
  position: absolute;
  bottom: -20%; left: -10%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(139,92,246,.12) 0%, transparent 65%);
  pointer-events: none;
}

.auth-card {
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: 0 40px 80px rgba(0,0,0,.4);
  padding: 2.5rem;
  width: 100%; max-width: 460px;
  position: relative;
  z-index: 1;
  animation: authCardIn .4s ease;
}
@keyframes authCardIn {
  from { opacity:0; transform: translateY(20px); }
  to   { opacity:1; transform: translateY(0); }
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-logo-icon {
  width: 60px; height: 60px;
  background: var(--grad-primary);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto .75rem;
  box-shadow: 0 8px 24px rgba(99,102,241,.45);
}
.auth-logo h1 { font-size: 1.5rem; color: var(--light-text); }
.auth-logo p  { font-size: .875rem; color: var(--light-muted); margin-top: .25rem; }

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

.auth-footer { text-align: center; margin-top: 1.5rem; font-size: .875rem; color: var(--light-muted); }
.auth-footer a { color: var(--primary); font-weight: 600; }

/* Password toggle */
.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 2.75rem; }
.password-toggle {
  position: absolute;
  right: .875rem; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--light-muted);
  cursor: pointer;
  padding: .25rem;
  font-size: .95rem;
  transition: color var(--t-fast);
}
.password-toggle:hover { color: var(--primary); }

/* =========================================================
   Blog Creator Form
   ========================================================= */
.creator-layout { display: grid; grid-template-columns: 1fr 260px; gap: 1.5rem; align-items: start; }

.url-input-wrap {
  position: relative;
}
.url-type-badge {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .55rem;
  border-radius: var(--radius-full);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.url-type-badge.youtube { background: rgba(239,68,68,.12); color: #dc2626; opacity: 1; }
.url-type-badge.product { background: rgba(16,185,129,.12); color: #059669; opacity: 1; }

/* Credit summary sidebar */
.credit-summary {
  background: var(--light-surface);
  border: 1px solid var(--light-border);
  border-radius: var(--radius-lg);
  overflow: hidden;

  top: 80px;
}
.credit-summary-header {
  background: var(--grad-primary);
  padding: .75rem 1rem;
  color: #fff;
}
.credit-summary-header h4 { font-size: .8rem; margin-bottom: .15rem; }
.credit-summary-balance   { font-size: 1.35rem; font-weight: 800; }
.credit-summary-balance span { font-size: .75rem; font-weight: 400; opacity: .75; }
.credit-summary-body { padding: .75rem 1rem; }
.cost-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .4rem 0;
  font-size: .8rem;
  border-bottom: 1px solid var(--light-border);
}
.cost-line:last-child { border-bottom: none; }
.cost-line .label { color: var(--light-muted); }
.cost-line .value { font-weight: 700; color: var(--light-text); }
.cost-line.total  .value { color: var(--danger); font-size: .9rem; }

/* =========================================================
   Blog Output / Result Page
   ========================================================= */
.blog-output {
  background: var(--light-surface);
  border: 1px solid var(--light-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.blog-output-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--light-border);
  flex-wrap: wrap; gap: 1rem;
}
.blog-meta { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.blog-preview {
  padding: 2rem 2.5rem;
  max-width: 860px;
}
.blog-preview h1 { font-size: 1.875rem; margin-bottom: 1rem; }
.blog-preview h2 { font-size: 1.375rem; margin: 2rem 0 .75rem; }
.blog-preview h3 { font-size: 1.125rem; margin: 1.5rem 0 .5rem; }
.blog-preview p  { margin-bottom: 1rem; line-height: 1.75; color: #374151; }
.blog-preview ul { margin: .75rem 0 1rem 1.5rem; list-style: disc; }
.blog-preview ul li { margin-bottom: .4rem; line-height: 1.65; color: #374151; }
.blog-preview .cta-block {
  background: linear-gradient(135deg, rgba(99,102,241,.08) 0%, rgba(139,92,246,.06) 100%);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  text-align: center;
  margin-top: 2rem;
}
.blog-preview .cta-block h3 { color: var(--primary-dark); margin-bottom: .75rem; }
.blog-preview .cta-block p  { color: var(--light-muted); font-size: .95rem; margin-bottom: 1.25rem; }

.code-view {
  background: #0f172a;
  padding: 1.5rem;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: .8rem;
  color: #e2e8f0;
  line-height: 1.75;
  display: none;
}
.code-view.active { display: block; }
.blog-preview.hidden { display: none; }

/* =========================================================
   History Table
   ========================================================= */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .875rem;
}
.data-table thead th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--light-muted);
  border-bottom: 1px solid var(--light-border);
  background: #f8fafc;
  white-space: nowrap;
}
.data-table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.data-table thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

.data-table tbody td {
  padding: 1rem;
  border-bottom: 1px solid var(--light-border);
  color: var(--light-text);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(99,102,241,.03); }
.data-table .td-title { font-weight: 600; max-width: 320px; }
.data-table .td-url   { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--light-muted); font-size: .8rem; }
.data-table .td-actions { white-space: nowrap; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: .35;
}
.empty-state h3   { font-size: 1.125rem; color: var(--light-text); margin-bottom: .5rem; }
.empty-state p    { font-size: .9rem; color: var(--light-muted); margin-bottom: 1.5rem; }

/* =========================================================
   Loading / Spinner
   ========================================================= */
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  flex-shrink: 0;
}
.spinner-primary {
  border-color: rgba(99,102,241,.25);
  border-top-color: var(--primary);
}

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

.generating-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.85);
  backdrop-filter: blur(8px);
  z-index: 9000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  color: #fff;
}
.generating-overlay.active { display: flex; }
.generating-spinner {
  width: 70px; height: 70px;
  border: 4px solid rgba(99,102,241,.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.generating-text { font-size: 1.2rem; font-weight: 600; }
.generating-sub  { font-size: .875rem; color: rgba(255,255,255,.55); }
.generating-steps { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.gen-step {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .875rem;
  color: rgba(255,255,255,.4);
  transition: color var(--t-base);
}
.gen-step.active   { color: var(--primary-light); }
.gen-step.complete { color: var(--success); }
.gen-step i { width: 16px; text-align: center; }

/* =========================================================
   Responsive Breakpoints
   ========================================================= */
@media (max-width: 1100px) {
  .creator-layout { grid-template-columns: 1fr; }
  .credit-summary { position: static; }
}

@media (max-width: 992px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero { padding-top: 6rem; }
  .hero-visual { display: none; }
  .steps::before { display: none; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }
  .sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .hamburger { display: flex; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .nav-links, .nav-actions .btn:not(.btn-accent) { display: none; }
  .nav-mobile-btn { display: flex; }

  .topbar { padding: 0 1rem; }
  .page-content { padding: 1.5rem 1rem; }
  .auth-card { padding: 1.75rem 1.25rem; }
  .blog-preview { padding: 1.5rem; }
  .plan-cards { grid-template-columns: 1fr; max-width: 380px; margin-left: auto; margin-right: auto; }
}

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .hero-stats { gap: 1.5rem; }
  .wc-group { gap: .375rem; }
  .wc-label { min-width: 60px; font-size: .8125rem; }
  .page-header { flex-direction: column; gap: .75rem; }
}

/* =========================================================
   Sidebar Mini (Collapsed) Mode
   ========================================================= */
.sidebar-mini-btn {
  margin-left: auto;
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05);
  color: var(--dark-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem;
  cursor: pointer;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.sidebar-mini-btn:hover { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.2); }

@media (min-width: 769px) {
  body.sidebar-mini .sidebar   { width: var(--sidebar-w-sm); }
  body.sidebar-mini .app-main  { margin-left: var(--sidebar-w-sm); }

  /* Logo row */
  body.sidebar-mini .sidebar-logo {
    padding: 1.125rem .625rem;
    gap: 0;
    justify-content: center;
    position: relative;
  }
  body.sidebar-mini .sidebar-logo-text { display: none; }
  body.sidebar-mini .sidebar-mini-btn {
    position: absolute;
    right: -13px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px; height: 26px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: 50%;
    z-index: 201;
    margin-left: 0;
  }

  /* Nav — allow overflow so tooltips escape the scroll container */
  body.sidebar-mini .sidebar-nav { overflow: visible; }
  body.sidebar-mini .sidebar-section-label { display: none; }
  body.sidebar-mini .sidebar-link {
    justify-content: center;
    padding: .75rem .5rem;
    margin: .1rem .375rem;
    overflow: visible;
  }
  body.sidebar-mini .sidebar-link span { display: none; }
  body.sidebar-mini .sidebar-link i {
    width: auto;
    font-size: 1.15rem;
    color: #cbd5e1;
  }
  body.sidebar-mini .sidebar-link:hover i,
  body.sidebar-mini .sidebar-link.active i { color: #fff; }

  /* Tooltip */
  body.sidebar-mini .sidebar-link::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--dark-surface);
    color: var(--dark-text);
    font-size: .8rem;
    font-weight: 600;
    padding: .35rem .75rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--t-fast);
    z-index: 300;
    border: 1px solid var(--dark-border);
    box-shadow: var(--shadow-md);
  }
  body.sidebar-mini .sidebar-link:hover::after { opacity: 1; }

  /* Credits + user */
  body.sidebar-mini .sidebar-credits { display: none; }
  body.sidebar-mini .sidebar-user {
    justify-content: center;
    flex-wrap: wrap;
    padding: .75rem .5rem;
    gap: .5rem;
  }
  body.sidebar-mini .user-name,
  body.sidebar-mini .user-email { display: none; }
  body.sidebar-mini .sidebar-user a { margin-left: 0 !important; }
}

/* =========================================================
   Scroll-reveal Animations
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: .1s; }
.reveal-delay-2 { transition-delay: .2s; }
.reveal-delay-3 { transition-delay: .3s; }
.reveal-delay-4 { transition-delay: .4s; }
