/* =========================================
   Heberking AI — Design System
   Theme: Dark Purple / New Tech
   ========================================= */

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

/* ── CSS Custom Properties ─────────────────── */
:root {
  /* Backgrounds */
  --bg-base:       #06060e;
  --bg-primary:    #09090f;
  --bg-secondary:  #0e0e1a;
  --bg-tertiary:   #141427;
  --bg-card:       #111120;
  --bg-card-hover: #181830;
  --bg-input:      #0c0c1c;

  /* Borders */
  --border:        rgba(124, 58, 237, 0.15);
  --border-light:  rgba(139, 92, 246, 0.25);
  --border-hover:  rgba(139, 92, 246, 0.5);

  /* Purple palette */
  --purple-950: #1e0642;
  --purple-900: #2e0d6e;
  --purple-800: #3d1a91;
  --purple-700: #5521b5;
  --purple-600: #6d28d9;
  --purple-500: #7c3aed;
  --purple-400: #8b5cf6;
  --purple-300: #a78bfa;
  --purple-200: #c4b5fd;
  --purple-100: #ede9fe;

  /* Text */
  --text-primary:   #f0eeff;
  --text-secondary: #9d97cc;
  --text-muted:     #5c5880;
  --text-disabled:  #3a3660;

  /* Semantic colors */
  --success:       #22c55e;
  --success-bg:    rgba(34, 197, 94, 0.1);
  --warning:       #f59e0b;
  --warning-bg:    rgba(245, 158, 11, 0.1);
  --error:         #f43f5e;
  --error-bg:      rgba(244, 63, 94, 0.1);
  --info:          #38bdf8;
  --info-bg:       rgba(56, 189, 248, 0.1);

  /* Shadows / Glows */
  --shadow-sm:     0 1px 4px rgba(0, 0, 0, 0.6);
  --shadow-md:     0 4px 20px rgba(0, 0, 0, 0.7);
  --shadow-lg:     0 8px 40px rgba(0, 0, 0, 0.8);
  --glow-sm:       0 0 20px rgba(124, 58, 237, 0.2);
  --glow-md:       0 0 40px rgba(124, 58, 237, 0.3);
  --glow-lg:       0 0 80px rgba(124, 58, 237, 0.4);

  /* Radius */
  --radius-xs:   4px;
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   18px;
  --radius-xl:   24px;
  --radius-2xl:  32px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast:   0.12s ease;
  --transition:        0.2s ease;
  --transition-slow:   0.35s ease;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Sidebar */
  --sidebar-width: 260px;
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--purple-300); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--purple-200); }

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Typography ────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.75rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p { color: var(--text-secondary); line-height: 1.7; }

.text-gradient {
  background: linear-gradient(135deg, var(--purple-300) 0%, #c084fc 50%, var(--purple-200) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-xs   { font-size: 0.75rem; }
.text-sm   { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }

.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }

/* ── Layout ────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-sm { max-width: 760px; }
.container-lg { max-width: 1400px; }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }

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

/* ── Buttons ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--transition);
  background: rgba(255, 255, 255, 0.06);
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--purple-600), var(--purple-500));
  color: #fff;
  border-color: var(--purple-500);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.35), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--purple-500), var(--purple-400));
  box-shadow: 0 0 30px rgba(124, 58, 237, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-light);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  box-shadow: var(--glow-sm);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-outline {
  background: transparent;
  color: var(--purple-300);
  border-color: var(--border-light);
}
.btn-outline:hover {
  background: rgba(124, 58, 237, 0.08);
  border-color: var(--purple-500);
  box-shadow: var(--glow-sm);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.12);
  color: var(--error);
  border-color: rgba(244, 63, 94, 0.25);
}
.btn-danger:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: var(--error);
}

.btn-success {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.25);
}
.btn-success:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--success);
}

.btn-sm { padding: 6px 14px; font-size: 0.8125rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-xl { padding: 16px 36px; font-size: 1.05rem; border-radius: var(--radius-lg); }
.btn-icon { padding: 8px; width: 36px; height: 36px; border-radius: var(--radius-sm); }
.btn-icon.btn-lg { width: 44px; height: 44px; padding: 10px; }

/* ── Cards ─────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition);
}

.card:hover { border-color: var(--border-light); }

.card-hover:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  box-shadow: var(--glow-sm), var(--shadow-md);
  transform: translateY(-2px);
}

.card-glass {
  background: rgba(17, 17, 32, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.card-subtitle { font-size: 0.8125rem; color: var(--text-muted); margin-top: 2px; }

/* ── Forms ─────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-label span { color: var(--error); margin-left: 2px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all var(--transition);
  outline: none;
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-disabled); }

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
  background: rgba(12, 12, 28, 0.9);
}

.form-input.error { border-color: var(--error); box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.1); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6891' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
  cursor: pointer;
}

.form-select option { background: var(--bg-secondary); }

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

.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 0.8rem; color: var(--error); margin-top: 5px; display: none; }
.form-error.visible { display: block; }

/* Input with icon */
.input-wrapper { position: relative; }
.input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.input-icon + .form-input { padding-left: 40px; }

.input-suffix {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Toggle / Switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: all var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition);
}
.toggle input:checked + .toggle-slider {
  background: var(--purple-600);
  border-color: var(--purple-500);
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: white;
}

/* Checkbox */
.checkbox-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.checkbox-wrapper input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--purple-500);
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
}

/* ── Badges ────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.badge-purple { background: rgba(124, 58, 237, 0.15); color: var(--purple-300); border: 1px solid rgba(124, 58, 237, 0.25); }
.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.25); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.25); }
.badge-error   { background: var(--error-bg); color: var(--error); border: 1px solid rgba(244, 63, 94, 0.25); }
.badge-info    { background: var(--info-bg); color: var(--info); border: 1px solid rgba(56, 189, 248, 0.25); }
.badge-muted   { background: rgba(92, 88, 128, 0.15); color: var(--text-muted); border: 1px solid rgba(92, 88, 128, 0.25); }

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge .dot.pulse { animation: pulse 1.5s infinite; }

/* ── Tables ────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead tr {
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

td {
  padding: 14px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background var(--transition-fast);
}
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.table-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* ── Stats Cards ───────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--glow-sm);
}

.stat-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-delta {
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-delta.up   { color: var(--success); }
.stat-delta.down { color: var(--error); }

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.stat-icon.purple { background: rgba(124, 58, 237, 0.15); color: var(--purple-400); }
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.blue   { background: var(--info-bg); color: var(--info); }

/* ── Alerts ────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  border: 1px solid;
}

.alert-icon { flex-shrink: 0; margin-top: 1px; }
.alert-title { font-weight: 600; margin-bottom: 2px; }

.alert-success { background: var(--success-bg); border-color: rgba(34, 197, 94, 0.25); color: var(--success); }
.alert-warning { background: var(--warning-bg); border-color: rgba(245, 158, 11, 0.25); color: var(--warning); }
.alert-error   { background: var(--error-bg); border-color: rgba(244, 63, 94, 0.25); color: var(--error); }
.alert-info    { background: var(--info-bg); border-color: rgba(56, 189, 248, 0.25); color: var(--info); }

/* ── Modals ────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), var(--glow-sm);
  transform: translateY(16px) scale(0.98);
  transition: transform var(--transition);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-lg { max-width: 700px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
}

.modal-title { font-size: 1.125rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  line-height: 1;
}
.modal-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.modal-body { padding: 20px 28px; }
.modal-footer {
  padding: 0 28px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ── Toast Notifications ───────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 420px;
  animation: slideInRight 0.25s ease;
}

.toast.removing { animation: slideOutRight 0.25s ease forwards; }

.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; color: var(--text-primary); }
.toast-desc { color: var(--text-muted); font-size: 0.8rem; margin-top: 2px; }
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px;
  transition: color var(--transition);
  flex-shrink: 0;
}
.toast-close:hover { color: var(--text-primary); }

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--error); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info    { border-left: 3px solid var(--purple-400); }

/* ── Progress Bar ──────────────────────────── */
.progress {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--purple-600), var(--purple-400));
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
  animation: shimmer 2s infinite;
}

/* ── Avatar ────────────────────────────────── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--purple-700), var(--purple-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: white;
  flex-shrink: 0;
  border: 2px solid var(--border-light);
}

.avatar-sm { width: 28px; height: 28px; font-size: 0.75rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.1rem; }
.avatar-xl { width: 72px; height: 72px; font-size: 1.5rem; }

/* ── Divider ───────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

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

/* ── Skeleton Loading ──────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-card-hover) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── Dropdown ──────────────────────────────── */
.dropdown { position: relative; display: inline-flex; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  min-width: 180px;
  padding: 6px;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: all var(--transition);
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.dropdown-item.danger { color: var(--error); }
.dropdown-item.danger:hover { background: var(--error-bg); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Tabs ──────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 4px;
  border: 1px solid var(--border);
}

.tab-item {
  flex: 1;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  white-space: nowrap;
}

.tab-item:hover { color: var(--text-secondary); }
.tab-item.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

/* ── Code Block ────────────────────────────── */
.code-block {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--purple-200);
  overflow-x: auto;
  line-height: 1.6;
  position: relative;
}

.code-block .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-size: 0.75rem;
}

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  transition: transform var(--transition-slow);
}

.sidebar-logo {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--purple-600), var(--purple-400));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  box-shadow: var(--glow-sm);
}

.sidebar-logo-text {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sidebar-logo-text span { color: var(--purple-400); }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

.sidebar-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.sidebar-item.active {
  background: rgba(124, 58, 237, 0.12);
  color: var(--purple-300);
  border: 1px solid rgba(124, 58, 237, 0.15);
}

.sidebar-item.active .sidebar-item-icon { color: var(--purple-400); }

.sidebar-item-icon { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-item-badge {
  margin-left: auto;
  background: var(--purple-600);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
}

.sidebar-user:hover { background: var(--bg-tertiary); }

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-email { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Main Content Area ─────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 32px; flex: 1; }

.app-legal-footer {
  padding: 16px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
}
.app-legal-footer a { color: var(--text-muted); text-decoration: none; margin: 0 8px; transition: color var(--transition); }
.app-legal-footer a:hover { color: var(--purple-400); }

.page-header { margin-bottom: 28px; }
.page-title { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.page-subtitle { font-size: 0.9rem; color: var(--text-muted); margin-top: 4px; }

/* ── Hamburger / Mobile ────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ── Navigation (Landing) ──────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  position: relative;
  z-index: 50;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--purple-600), var(--purple-400));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: var(--glow-sm);
}

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

.nav-links a {
  padding: 7px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

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

/* ── Footer ────────────────────────────────── */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 60px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer-brand p { font-size: 0.9rem; color: var(--text-muted); margin-top: 12px; max-width: 260px; }

.footer-title { font-size: 0.875rem; font-weight: 700; color: var(--text-primary); margin-bottom: 16px; }

.footer-links { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-links a { font-size: 0.875rem; color: var(--text-muted); transition: color var(--transition); }
.footer-links a:hover { color: var(--text-secondary); }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ── Gradient effects ──────────────────────── */
.gradient-mesh {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(91, 33, 182, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 10%, rgba(109, 40, 217, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse 50% 60% at 50% 80%, rgba(124, 58, 237, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.5;
}

.glow-orb-1 {
  width: 400px;
  height: 400px;
  top: -100px;
  left: -100px;
  background: radial-gradient(circle, rgba(91, 33, 182, 0.4) 0%, transparent 70%);
}

.glow-orb-2 {
  width: 300px;
  height: 300px;
  top: 50%;
  right: -80px;
  background: radial-gradient(circle, rgba(109, 40, 217, 0.3) 0%, transparent 70%);
}

/* ── Gradient border cards ─────────────────── */
.card-border-gradient {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
}

.card-border-gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.5), transparent 60%, rgba(139, 92, 246, 0.2));
  border-radius: inherit;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ── Animations ────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: var(--glow-sm); }
  50% { box-shadow: var(--glow-md); }
}

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

.animate-spin { animation: spin 1s linear infinite; }
.animate-float { animation: float 4s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-fade-in { animation: fadeIn 0.4s ease forwards; }
.animate-fade-in-up { animation: fadeInUp 0.4s ease forwards; }
.animate-glow { animation: glow-pulse 3s ease-in-out infinite; }

/* ── Utilities ─────────────────────────────── */
.hidden { display: none !important; }
.visible { visibility: visible; }
.invisible { visibility: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }
.overflow-hidden { overflow: hidden; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.rounded { border-radius: var(--radius-md); }
.rounded-full { border-radius: var(--radius-full); }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-all { word-break: break-all; }

.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.pointer-events-none { pointer-events: none; }

/* ── Scrollbar ─────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── Responsive ────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-content { padding: 20px 16px; }
  .topbar { padding: 14px 20px; }
  .nav-links { display: none; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
}

@media (max-width: 480px) {
  .modal { border-radius: var(--radius-lg); }
  .btn-xl { padding: 13px 24px; }
}
