/* ================================================================
   Dreamit SaaS — Global Stylesheet
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg-deep:       #07070f;
  --bg-dark:       #0d0d1a;
  --bg-card:       rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --border:        rgba(255,255,255,0.08);
  --border-bright: rgba(139,92,246,0.4);
  --accent:        #8b5cf6;
  --accent-2:      #6366f1;
  --accent-glow:   rgba(139,92,246,0.25);
  --green:         #10b981;
  --red:           #ef4444;
  --yellow:        #f59e0b;
  --text-primary:  #f0f0ff;
  --text-secondary:#8b90a8;
  --text-muted:    #4a4e6a;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow-card:   0 4px 32px rgba(0,0,0,0.4);
  --shadow-glow:   0 0 40px rgba(139,92,246,0.15);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 680px; margin: 0 auto; padding: 0 24px; }

/* ---- Nav ---- */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(7,7,15,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.nav-logo {
  font-size: 1.4rem; font-weight: 800;
  background: linear-gradient(135deg, #8b5cf6, #6366f1, #3b82f6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a {
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500; color: var(--text-secondary);
  transition: all .2s;
}
.nav-links a:hover { color: var(--text-primary); background: var(--bg-card); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all .2s; text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border-color: var(--accent);
  box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-primary:hover {
  transform: translateY(-1px); box-shadow: 0 6px 25px var(--accent-glow);
  color: #fff;
}
.btn-outline {
  background: transparent; color: var(--text-primary);
  border-color: var(--border); 
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.btn-ghost { background: var(--bg-card); color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.card:hover { border-color: var(--border-bright); }

/* ---- Forms ---- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .05em; }
.form-control {
  width: 100%; padding: 12px 16px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 0.9rem; transition: border-color .2s, box-shadow .2s;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control::placeholder { color: var(--text-muted); }
.form-error { color: var(--red); font-size: 0.8rem; margin-top: 6px; }
.form-help { color: var(--text-muted); font-size: 0.8rem; margin-top: 6px; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.badge-free   { background: rgba(148,163,184,.15); color: #94a3b8; border: 1px solid rgba(148,163,184,.2); }
.badge-family { background: rgba(16,185,129,.12);  color: var(--green); border: 1px solid rgba(16,185,129,.25); }
.badge-pro    { background: rgba(139,92,246,.15);  color: var(--accent); border: 1px solid var(--border-bright); }

/* ---- Alert ---- */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); font-size: 0.875rem; margin-bottom: 20px; }
.alert-error   { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.alert-success { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.3); color: #6ee7b7; }
.alert-info    { background: rgba(99,102,241,.1); border: 1px solid rgba(99,102,241,.3); color: #a5b4fc; }
.alert-warn    { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3); color: #fcd34d; }

/* ---- Hero ---- */
.hero {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 120px 24px 80px;
  position: relative; overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(139,92,246,.3) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(99,102,241,.2) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 10% 70%, rgba(59,130,246,.15) 0%, transparent 60%);
}
.hero-content { position: relative; z-index: 1; max-width: 820px; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(139,92,246,.12); border: 1px solid var(--border-bright);
  border-radius: 999px; padding: 6px 16px; font-size: 0.8rem; font-weight: 600;
  color: var(--accent); margin-bottom: 28px; letter-spacing: .05em;
}
.hero h1 {
  font-size: clamp(2.4rem, 7vw, 5rem); font-weight: 900; line-height: 1.05;
  letter-spacing: -.03em; margin-bottom: 24px;
  background: linear-gradient(135deg, #fff 40%, #8b5cf6 70%, #6366f1 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p { font-size: 1.15rem; color: var(--text-secondary); max-width: 560px; margin: 0 auto 40px; line-height: 1.7; }
.hero-cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* ---- Pricing ---- */
.pricing-section { padding: 100px 24px; }
.section-header { text-align: center; margin-bottom: 64px; }
.section-header h2 {
  font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; margin-bottom: 16px;
  background: linear-gradient(135deg, #fff, #8b5cf6); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
}
.section-header p { color: var(--text-secondary); font-size: 1.05rem; max-width: 500px; margin: 0 auto; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; max-width: 1100px; margin: 0 auto; }
.pricing-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; padding: 36px; transition: all .3s; position: relative; overflow: hidden;
}
.pricing-card.featured {
  border-color: var(--accent); background: rgba(139,92,246,.07);
  box-shadow: var(--shadow-glow);
}
.pricing-card.featured::before {
  content: 'POPULAR';
  position: absolute; top: 16px; right: -28px;
  background: var(--accent); color: #fff; font-size: 0.65rem; font-weight: 800;
  padding: 4px 36px; transform: rotate(45deg); letter-spacing: .1em;
}
.pricing-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card); }
.pricing-tier { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--text-muted); margin-bottom: 12px; }
.pricing-price { font-size: 3rem; font-weight: 900; color: var(--text-primary); margin-bottom: 4px; }
.pricing-price span { font-size: 1rem; font-weight: 500; color: var(--text-secondary); }
.pricing-annual { font-size: 0.8rem; color: var(--green); margin-bottom: 24px; }
.pricing-features { list-style: none; margin-bottom: 32px; }
.pricing-features li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; font-size: 0.875rem; color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.pricing-features li:last-child { border-bottom: none; }
.pricing-features .check { color: var(--green); font-size: 1rem; }
.pricing-features .lock  { color: var(--text-muted); font-size: 0.9rem; }

/* ---- Features ---- */
.features-section { padding: 80px 24px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; max-width: 1100px; margin: 0 auto; }
.feature-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; transition: all .3s;
}
.feature-card:hover { border-color: var(--border-bright); transform: translateY(-3px); }
.feature-icon {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; margin-bottom: 18px;
}
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 10px; }
.feature-card p { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.6; }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border); padding: 40px 24px;
  text-align: center; color: var(--text-muted); font-size: 0.8rem;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* ---- Auth pages ---- */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 80px 24px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(139,92,246,.2) 0%, transparent 70%),
    var(--bg-deep);
}
.auth-card { width: 100%; max-width: 460px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo a {
  font-size: 2rem; font-weight: 900;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-card h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; }
.auth-card .subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 32px; }
.auth-footer { text-align: center; margin-top: 24px; color: var(--text-secondary); font-size: 0.85rem; }

/* ---- Dashboard ---- */
.dash-layout { display: flex; min-height: 100vh; }
.dash-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--bg-dark); border-right: 1px solid var(--border);
  padding: 24px 0; position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  display: flex; flex-direction: column;
}
.dash-logo { padding: 0 24px 24px; font-size: 1.3rem; font-weight: 900;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; border-bottom: 1px solid var(--border);
}
.dash-nav { padding: 16px 12px; flex: 1; }
.dash-nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); color: var(--text-secondary);
  font-size: 0.875rem; font-weight: 500; cursor: pointer;
  transition: all .2s; text-decoration: none; border: none; background: none;
  width: 100%; text-align: left;
}
.dash-nav-item:hover { color: var(--text-primary); background: var(--bg-card); }
.dash-nav-item.active { color: var(--accent); background: rgba(139,92,246,.12); }
.dash-nav-item svg, .dash-nav-item .nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.dash-content { margin-left: 240px; flex: 1; min-height: 100vh; }
.dash-header {
  padding: 20px 32px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(13,13,26,.8); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 40;
}
.dash-main { padding: 32px; }
.dash-page-title { font-size: 1.4rem; font-weight: 800; }

/* ---- Stats Cards ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.stat-value { font-size: 1.6rem; font-weight: 800; }
.stat-sub { font-size: 0.78rem; color: var(--text-secondary); margin-top: 4px; }

/* ---- App Shell (the SaaS editor) ---- */
.app-shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; background: var(--bg-deep); }
.app-toolbar {
  height: 52px; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; border-bottom: 1px solid var(--border);
  background: var(--bg-dark); flex-shrink: 0; z-index: 30;
}
.app-toolbar .url-bar {
  flex: 1; display: flex; align-items: center;
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.app-toolbar .url-bar input {
  flex: 1; background: none; border: none; padding: 8px 14px;
  color: var(--text-primary); font-size: 0.85rem;
}
.app-toolbar .url-bar input:focus { outline: none; }
.app-toolbar .icon-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text-secondary); cursor: pointer;
  border-radius: var(--radius-sm); transition: all .15s;
}
.app-toolbar .icon-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.app-body { display: flex; flex: 1; overflow: hidden; }
.app-left {
  width: 220px; flex-shrink: 0; background: var(--bg-dark);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto;
}
.app-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px;
  cursor: pointer; color: var(--text-secondary); font-size: 0.85rem;
  font-weight: 500; border-left: 3px solid transparent; transition: all .15s;
  border: none; background: none; width: 100%; text-align: left;
}
.app-nav-item:hover { color: var(--text-primary); background: var(--bg-card); }
.app-nav-item.active { color: var(--accent); background: rgba(139,92,246,.1); border-left-color: var(--accent); }
.app-nav-item.locked { opacity: .45; cursor: not-allowed; }
.app-nav-item.locked:hover { background: none; color: var(--text-secondary); }
.lock-icon { font-size: 0.7rem; margin-left: auto; background: rgba(245,158,11,.2); color: var(--yellow); padding: 2px 6px; border-radius: 4px; }
.browser-frame { flex: 1; position: relative; overflow: hidden; background: #fff; }
.browser-frame iframe { width: 100%; height: 100%; border: none; display: block; }
.browser-loading {
  position: absolute; inset: 0; background: var(--bg-deep);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px; color: var(--text-secondary);
}
.app-right {
  width: 280px; flex-shrink: 0; background: var(--bg-dark);
  border-left: 1px solid var(--border); display: flex; flex-direction: column;
  overflow-y: auto;
}
.app-right-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.85rem; font-weight: 600;
}
.prop-section { border-bottom: 1px solid var(--border); }
.prop-section-header {
  padding: 10px 16px; font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted);
  cursor: pointer; display: flex; justify-content: space-between;
  background: none; border: none; width: 100%; text-align: left; color: var(--text-secondary);
}
.prop-section-header:hover { color: var(--text-primary); }
.prop-content { padding: 12px 16px; }
.prop-row { display: flex; gap: 8px; }
.prop-row .form-group { flex: 1; }
.color-input-wrap { display: flex; gap: 8px; align-items: center; }
.color-swatch { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; flex-shrink: 0; }

/* ---- Upgrade banner ---- */
.upgrade-banner {
  margin: 16px; padding: 16px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(139,92,246,.15), rgba(99,102,241,.1));
  border: 1px solid var(--border-bright); text-align: center;
}
.upgrade-banner h4 { font-size: 0.875rem; margin-bottom: 6px; }
.upgrade-banner p { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 12px; }

/* ---- Progress / Log ---- */
.progress-log {
  background: #000; border-radius: var(--radius-sm); padding: 16px;
  font-family: monospace; font-size: 0.78rem; color: #4ade80;
  max-height: 200px; overflow-y: auto; margin-top: 16px;
  border: 1px solid var(--border);
}
.progress-log p { margin: 0; line-height: 1.8; }
.progress-log .log-error { color: #f87171; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; backdrop-filter: blur(6px);
}
.modal-box {
  background: var(--bg-dark); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px; width: 90%; max-width: 500px;
  box-shadow: var(--shadow-card);
}
.modal-box h2 { font-size: 1.2rem; font-weight: 800; margin-bottom: 8px; }
.modal-box p { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ---- Tier notice in app ---- */
.tier-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(139,92,246,.12); border: 1px solid var(--border-bright);
  padding: 4px 12px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: .05em;
}

/* ---- Spinner ---- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .dash-sidebar { display: none; }
  .dash-content { margin-left: 0; }
  .app-left { display: none; }
  .app-right { display: none; }
  .hero h1 { font-size: 2.2rem; }
}
