/* ╔══════════════════════════════════════════════════════╗
   ║              DESIGN TOKENS  (edit here!)            ║
   ╚══════════════════════════════════════════════════════╝
   All visual properties live as CSS variables so a
   theme swap is a single class toggle on <html>.        */

/* ── Dark theme (default) ───────────────────────────── */
:root {
  --primary:        #10B981;
  --primary-light:  #34D399;
  --primary-dark:   #059669;
  --primary-glow:   rgba(16, 185, 129, 0.25);

  --bg:             #07030f;
  --surface:        rgba(255, 255, 255, 0.04);
  --surface-hover:  rgba(255, 255, 255, 0.07);
  --surface-dark:   rgba(0,   0,   0,   0.22);
  --border:         rgba(255, 255, 255, 0.08);
  --border-strong:  rgba(255, 255, 255, 0.16);

  --text-primary:   rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-muted:     rgba(255, 255, 255, 0.28);

  --input-bg:       rgba(0, 0, 0, 0.22);
  --input-bg-hover: rgba(0, 0, 0, 0.32);

  --nav-bg:         rgba(7,  3,  15, 0.65);
  --sidebar-bg:     rgba(7,  3,  15, 0.88);
  --header-bg:      rgba(7,  3,  15, 0.50);
  --orb-opacity:    0.32;
}

/* ── Light theme ─────────────────────────────────────── */
html.light {
  --bg:             #f0eeff;
  --surface:        rgba(255, 255, 255, 0.68);
  --surface-hover:  rgba(255, 255, 255, 0.90);
  --surface-dark:   rgba(16, 185, 129, 0.05);
  --border:         rgba(0,   0,   0,   0.07);
  --border-strong:  rgba(0,   0,   0,   0.14);

  --text-primary:   rgba(18,  10, 35,  0.92);
  --text-secondary: rgba(18,  10, 35,  0.54);
  --text-muted:     rgba(18,  10, 35,  0.28);

  --input-bg:       rgba(0,   0,   0,   0.04);
  --input-bg-hover: rgba(0,   0,   0,   0.07);

  --nav-bg:         rgba(240, 238, 255, 0.80);
  --sidebar-bg:     rgba(244, 242, 255, 0.95);
  --header-bg:      rgba(244, 242, 255, 0.70);
  --orb-opacity:    0.16;
  color-scheme: light;
}

/* ── Global reset ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: 'DM Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 300ms ease, color 300ms ease;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 99px; }

/* ── Ambient orbs ───────────────────────────────────────── */
.orb-container {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.orb {
  position: absolute; border-radius: 50%; filter: blur(90px);
  opacity: var(--orb-opacity, 0.32);
  transition: opacity 400ms ease;
}
.orb-1 {
  width: 640px; height: 640px;
  background: radial-gradient(circle, #10B981 0%, transparent 68%);
  top: -220px; right: -180px;
  animation: orb-drift 22s ease-in-out infinite alternate;
}
.orb-2 {
  width: 440px; height: 440px;
  background: radial-gradient(circle, #047857 0%, transparent 68%);
  bottom: -120px; left: -120px;
  animation: orb-drift 28s ease-in-out infinite alternate-reverse;
}
.orb-3 {
  width: 320px; height: 320px;
  background: radial-gradient(circle, #0EA5E9 0%, transparent 68%);
  top: 45%; left: 35%;
  opacity: calc(var(--orb-opacity, 0.32) * 0.4);
  animation: orb-drift 34s ease-in-out infinite;
}
@keyframes orb-drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(28px, 18px) scale(1.06); }
}

/* ── Z-index stacking ───────────────────────────────────── */
#nav, #outlet { position: relative; z-index: 1; }
#nav { position: sticky; top: 0; z-index: 40; }

/* ── Page entrance ──────────────────────────────────────── */
#outlet > * {
  animation: page-in 380ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ╔══════════════════════════════════════════════════════╗
   ║               COMPONENT CLASSES                     ║
   ╚══════════════════════════════════════════════════════╝ */

/* ── Glass surfaces ─────────────────────────────────────── */
.glass {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: background 200ms ease, border-color 200ms ease;
}
.glass-dark {
  background: var(--surface-dark);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.glass-hover {
  transition: background 200ms ease, border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.glass-hover:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}

/* ── Buttons ────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px;
  background: linear-gradient(135deg, var(--primary) 0%, #047857 100%);
  color: white;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 600; font-size: 0.9rem; letter-spacing: 0.01em;
  border-radius: 10px; border: none; cursor: pointer;
  transition: opacity 200ms ease, transform 200ms ease, box-shadow 200ms ease;
  text-decoration: none; white-space: nowrap;
}
.btn-primary:hover:not(:disabled) {
  opacity: 0.88; transform: translateY(-1px);
  box-shadow: 0 8px 28px var(--primary-glow), 0 0 0 1px rgba(16,185,129,0.3);
}
.btn-primary:active  { transform: translateY(0); }
.btn-primary:disabled{ opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px;
  background: var(--surface);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 500; font-size: 0.9rem;
  border-radius: 10px; border: 1px solid var(--border); cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease, transform 200ms ease;
  text-decoration: none; white-space: nowrap;
}
.btn-ghost:hover {
  background: var(--surface-hover); border-color: var(--border-strong);
  transform: translateY(-1px);
}

/* ── Inputs ─────────────────────────────────────────────── */
.glass-input {
  display: block; width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px;
  color: var(--text-primary);
  font-family: 'DM Sans', system-ui, sans-serif; font-size: 0.95rem;
  outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
}
.glass-input::placeholder { color: var(--text-muted); }
.glass-input:hover  { background: var(--input-bg-hover); }
.glass-input:focus  {
  border-color: var(--primary);
  background: var(--input-bg-hover);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.18);
}

/* ── Labels & dividers ──────────────────────────────────── */
.glass-label {
  display: block; font-size: 0.78rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 7px;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.glass-divider { height: 1px; background: var(--border); margin: 12px 0; }

/* ── Typography ─────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, #34D399 0%, #38BDF8 55%, #34D399 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-shift 9s ease infinite;
}
html.light .gradient-text {
  background: linear-gradient(135deg, #059669 0%, #0369A1 55%, #059669 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-shift 9s ease infinite;
}
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}
.font-display { font-family: 'Syne', system-ui, sans-serif; }

/* ── Nav ────────────────────────────────────────────────── */
nav.main-nav {
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  transition: background 300ms ease, border-color 300ms ease;
}
.nav-link {
  padding: 6px 12px; border-radius: 8px;
  color: var(--text-secondary); text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
  transition: color 150ms ease, background 150ms ease;
}
.nav-link:hover { color: var(--text-primary); background: var(--surface); }

/* ── Badge / Pill ───────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
}
.badge-green  { background: rgba(16,185,129,0.12); color: #34D399; border: 1px solid rgba(16,185,129,0.22); }
.badge-red    { background: rgba(239,68,68,0.12);  color: #F87171; border: 1px solid rgba(239,68,68,0.22); }
.badge-violet { background: rgba(16,185,129,0.12); color: #34D399; border: 1px solid rgba(16,185,129,0.22); }
.badge-blue   { background: rgba(14,165,233,0.12); color: #38BDF8; border: 1px solid rgba(14,165,233,0.22); }

html.light .badge-green  { color: #059669; }
html.light .badge-red    { color: #DC2626; }
html.light .badge-violet { color: #059669; }
html.light .badge-blue   { color: #0284C7; }

/* ── Avatar ─────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #047857 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 0.8rem; font-weight: 700; color: white;
  flex-shrink: 0; user-select: none;
}

/* ── Error box ──────────────────────────────────────────── */
.error-box {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px;
  font-size: 0.875rem; color: #F87171;
  background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2);
}
html.light .error-box { color: #DC2626; }

/* ── Table ──────────────────────────────────────────────── */
.glass-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.glass-table th {
  padding: 10px 14px; text-align: left;
  color: var(--text-muted); font-weight: 600;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.glass-table td {
  padding: 12px 14px; color: var(--text-primary);
  border-bottom: 1px solid rgba(255,255,255,0.035);
  transition: background 120ms ease;
}
html.light .glass-table td { border-bottom: 1px solid rgba(0,0,0,0.04); }
.glass-table tr:last-child td  { border-bottom: none; }
.glass-table tr:hover td       { background: var(--surface); }

/* ╔══════════════════════════════════════════════════════╗
   ║              DASHBOARD LAYOUT                       ║
   ╚══════════════════════════════════════════════════════╝ */

.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 256px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-right: 1px solid var(--border); z-index: 50;
  display: flex; flex-direction: column; padding: 24px 14px;
  overflow-y: auto;
  transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1),
              background 300ms ease, border-color 300ms ease;
}

/* Mobile: sidebar slides in from left */
@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 40px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 49;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
@media (max-width: 1023px) {
  .sidebar-overlay.open { display: block; }
}

.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text-secondary); text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
  cursor: pointer; border: 1px solid transparent;
  background: none; width: 100%; text-align: left;
  font-family: 'DM Sans', system-ui, sans-serif;
}
.sidebar-link:hover { background: var(--surface-hover); color: var(--text-primary); }
.sidebar-link.active {
  background: linear-gradient(135deg, rgba(16,185,129,0.18) 0%, rgba(5,150,105,0.12) 100%);
  color: #34D399; border-color: rgba(16,185,129,0.22);
}
html.light .sidebar-link.active { color: #059669; }

.dashboard-main {
  margin-left: 256px; min-height: 100vh;
  transition: margin-left 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
@media (max-width: 1023px) {
  .dashboard-main { margin-left: 0; }
}

/* ── Stat card accent ───────────────────────────────────── */
.stat-card { position: relative; overflow: hidden; }
.stat-card::after {
  content: ''; position: absolute; top: -20px; right: -20px;
  width: 90px; height: 90px;
  background: radial-gradient(circle, rgba(16,185,129,0.12) 0%, transparent 70%);
  border-radius: 50%; pointer-events: none;
}

/* ╔══════════════════════════════════════════════════════╗
   ║              SCROLL DEMO                            ║
   ╚══════════════════════════════════════════════════════╝ */

/* Marquee tracks */
.marquee-track {
  display: flex; gap: 40px;
  animation: marquee-left 20s linear infinite;
  white-space: nowrap; will-change: transform;
}
.marquee-track.reverse { animation-name: marquee-right; }

@keyframes marquee-left {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@keyframes marquee-right {
  from { transform: translateX(-50%); }
  to   { transform: translateX(0); }
}

/* Stacking cards container */
.stack-wrapper {
  position: relative; width: 100%; max-width: 440px;
  height: 300px; margin: 0 auto;
}
.stack-card-item {
  position: absolute; inset: 0;
  border-radius: 20px; padding: 28px 32px;
  display: flex; flex-direction: column; justify-content: flex-end;
  will-change: transform, opacity;
  transition: none; /* JS controls this */
}

/* ╔══════════════════════════════════════════════════════╗
   ║              SCROLL SNAP                            ║
   ╚══════════════════════════════════════════════════════╝ */
.snap-outer {
  height: 100vh; overflow-y: scroll;
  scroll-snap-type: y mandatory; scroll-behavior: smooth;
  overscroll-behavior: contain;
}
.snap-section {
  height: 100vh; scroll-snap-align: start;
  display: flex; flex-direction: column;
}

/* ── Mobile nav hamburger ───────────────────────────────── */
.mobile-menu-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(320px, 85vw);
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-left: 1px solid var(--border);
  z-index: 100; padding: 24px 20px;
  display: flex; flex-direction: column; gap: 8px;
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}
.mobile-menu-panel.open { transform: translateX(0); }
.mobile-menu-overlay {
  position: fixed; inset: 0; z-index: 99;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(2px);
  display: none;
}
.mobile-menu-overlay.open { display: block; }

/* ╔══════════════════════════════════════════════════════╗
   ║              MODAL                                  ║
   ╚══════════════════════════════════════════════════════╝ */

.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, 0.60);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-dialog {
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  border-radius: 20px;
}
.modal-dialog-lg { max-width: 640px; }

/* ╔══════════════════════════════════════════════════════╗
   ║              TOAST NOTIFICATIONS                    ║
   ╚══════════════════════════════════════════════════════╝ */

.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 80;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  max-width: 360px; width: calc(100vw - 48px);
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 14px;
  background: rgba(12, 6, 24, 0.92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.04);
}
html.light .toast { background: rgba(250,248,255,0.95); }
.toast-success { border-left: 3px solid #34D399; }
.toast-error   { border-left: 3px solid #F87171; }
.toast-info    { border-left: 3px solid #38BDF8; }
.toast-warn    { border-left: 3px solid #FCD34D; }
.toast-msg     { flex: 1; font-size: 0.875rem; color: var(--text-primary); }
.toast-icon    { flex-shrink: 0; display: flex; align-items: center; }
.toast-close {
  flex-shrink: 0; border-radius: 6px; padding: 3px;
  color: var(--text-muted); background: none; border: none; cursor: pointer;
  transition: background 150ms ease; display: flex; align-items: center;
}
.toast-close:hover { background: rgba(255,255,255,0.1); }

/* ╔══════════════════════════════════════════════════════╗
   ║              FILE UPLOAD ZONE                       ║
   ╚══════════════════════════════════════════════════════╝ */

.upload-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; min-height: 160px; padding: 32px 24px;
  border: 2px dashed var(--border-strong); border-radius: 16px;
  cursor: pointer; text-align: center; color: var(--text-secondary);
  transition: border-color 200ms ease, background 200ms ease;
  background: var(--surface);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.06);
}

/* ╔══════════════════════════════════════════════════════╗
   ║              COMBOBOX / SELECT                      ║
   ╚══════════════════════════════════════════════════════╝ */

.combobox-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
  padding-bottom: 6px; border-radius: 14px;
  max-height: 260px; overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}
.combobox-list { max-height: 180px; overflow-y: auto; padding: 0 6px; }
.combobox-option {
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 0.875rem; list-style: none;
  transition: background 120ms ease; color: var(--text-secondary);
}
.combobox-option:hover { background: var(--surface-hover); color: var(--text-primary); }
.combobox-option-active {
  background: rgba(16,185,129,0.12); color: #34D399;
}
html.light .combobox-option-active { color: #059669; }
.combobox-empty {
  padding: 14px; text-align: center; font-size: 0.875rem;
  color: var(--text-muted); list-style: none;
}

/* ╔══════════════════════════════════════════════════════╗
   ║              ONBOARDING STEPS                       ║
   ╚══════════════════════════════════════════════════════╝ */

.step-track { display: flex; align-items: center; }
.step-dot {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  border: 2px solid var(--border); font-size: 0.82rem; font-weight: 700;
  color: var(--text-muted); background: var(--surface);
  transition: all 250ms ease;
}
.step-dot.active {
  border-color: var(--primary);
  background: rgba(16,185,129,0.18);
  color: #34D399;
  box-shadow: 0 0 0 4px rgba(16,185,129,0.12);
}
.step-dot.done {
  border-color: #34D399;
  background: rgba(16,185,129,0.14);
  color: #34D399;
}
.step-line {
  flex: 1; height: 2px; background: var(--border);
  min-width: 20px; transition: background 300ms ease;
}
.step-line.done { background: #34D399; }
.step-label {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; margin-top: 6px; color: var(--text-muted);
  transition: color 200ms ease; text-align: center; white-space: nowrap;
}
.step-label.active { color: #34D399; }
html.light .step-label.active { color: #059669; }
.step-label.done  { color: #34D399; }

/* ╔══════════════════════════════════════════════════════╗
   ║              NOTIFICATION ITEM                      ║
   ╚══════════════════════════════════════════════════════╝ */

.notif-item {
  display: flex; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 150ms ease; cursor: default;
  position: relative;
}
.notif-item:last-child  { border-bottom: none; }
.notif-item:hover       { background: var(--surface-hover); }
.notif-item.unread::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; border-radius: 0 2px 2px 0;
  background: var(--primary);
}

/* ╔══════════════════════════════════════════════════════╗
   ║              SETTINGS TABS                          ║
   ╚══════════════════════════════════════════════════════╝ */

.settings-tab {
  padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.875rem; font-weight: 500; background: none;
  color: var(--text-secondary);
  transition: background 150ms ease, color 150ms ease;
}
.settings-tab:hover  { background: var(--surface); color: var(--text-primary); }
.settings-tab.active {
  background: rgba(16,185,129,0.14);
  color: #34D399;
}
html.light .settings-tab.active { color: #059669; }

/* ── Plan card highlight ──────────────────────────────── */
.plan-card-popular {
  border-color: rgba(16,185,129,0.4) !important;
  box-shadow: 0 0 0 1px rgba(16,185,129,0.2), 0 16px 48px rgba(16,185,129,0.12);
}
