/* ═══════════════════════════════════════════════════════════════════════════
   Sidecue Web Dashboard — Unified Design System
   Brand Color: #4F6AE8 (Sidecue Blue)
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap');

/* ═══════════════════════ DESIGN TOKENS ═══════════════════════ */

:root {
  /* ═══ Brand Colors (from Sidecue Logo) ═══ */
  --brand-primary: #4F6AE8;
  --brand-primary-light: #6B82ED;
  --brand-primary-dark: #3D54C7;
  --brand-gradient: linear-gradient(135deg, #4F6AE8 0%, #7C5CE8 100%);
  
  /* ═══ Light Theme (Default) ═══ */
  --surface-base: #F8FAFC;
  --surface-1: #FFFFFF;
  --surface-2: #F1F5F9;
  --surface-3: #E2E8F0;
  --surface-4: #CBD5E1;
  
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-faint: #94A3B8;
  
  --border-default: #E2E8F0;
  --border-subtle: #F1F5F9;
  --border-strong: #CBD5E1;
  
  /* ═══ Semantic Colors ═══ */
  --accent: var(--brand-primary);
  --accent-light: var(--brand-primary-light);
  --accent-dim: rgba(79, 106, 232, 0.08);
  --accent-glow: rgba(79, 106, 232, 0.15);
  
  --success: #10B981;
  --success-light: #34D399;
  --success-dim: rgba(16, 185, 129, 0.08);
  
  --danger: #EF4444;
  --danger-light: #F87171;
  --danger-dim: rgba(239, 68, 68, 0.08);
  
  --warning: #F59E0B;
  --warning-light: #FBBF24;
  --warning-dim: rgba(245, 158, 11, 0.08);
  
  /* ═══ Layout ═══ */
  --sidebar-width: 260px;
  --header-height: 64px;
  --content-max-width: 1100px;
  
  /* ═══ Spacing & Radii ═══ */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* ═══ Shadows ═══ */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 24px var(--accent-glow);
}

/* ═══ Dark Theme ═══ */
.dark {
  --surface-base: #0B0E14;
  --surface-1: #0F1218;
  --surface-2: #161A22;
  --surface-3: #1E232D;
  --surface-4: #282E3A;
  
  --text-primary: #F4F4F6;
  --text-secondary: #A8AEBF;
  --text-muted: #6B7280;
  --text-faint: #4B5260;
  
  --border-default: #1E232D;
  --border-subtle: #161A22;
  --border-strong: #282E3A;
  
  --accent-dim: rgba(79, 106, 232, 0.12);
  --accent-glow: rgba(79, 106, 232, 0.25);
  
  --success-dim: rgba(52, 211, 153, 0.12);
  --danger-dim: rgba(248, 113, 113, 0.12);
  --warning-dim: rgba(251, 191, 36, 0.12);
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* ═══════════════════════ BASE ═══════════════════════ */

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--surface-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* ═══════════════════════ LAYOUT ═══════════════════════ */

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface-1);
  border-right: 1px solid var(--border-default);
}

.main-content {
  padding: 28px;
  background: var(--surface-base);
  min-height: 100vh;
}

@media (min-width: 1024px) {
  .main-content {
    margin-left: var(--sidebar-width);
    padding: 36px 48px;
  }
}

.content-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

@media (max-width: 1023px) {
  .main-content {
    padding-top: calc(var(--header-height) + 28px);
  }
}

/* No sidebar layout (login/auth pages) */
.main-content.no-sidebar {
  margin-left: 0 !important;
  padding-top: 28px !important;
}

@media (min-width: 1024px) {
  .main-content.no-sidebar {
    padding-top: 36px !important;
  }
}

/* ═══════════════════════ CARDS ═══════════════════════ */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.2s ease;
}

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

/* ═══════════════════════ STATS CARDS ═══════════════════════ */

.stat-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ═══════════════════════ BUTTONS ═══════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--brand-gradient);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-1);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-gradient {
  background: var(--brand-gradient);
  color: white;
  box-shadow: 0 4px 16px rgba(79, 106, 232, 0.3);
}

.btn-gradient:hover {
  box-shadow: 0 6px 24px rgba(79, 106, 232, 0.4);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

/* ═══════════════════════ NAVIGATION ═══════════════════════ */

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s ease;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

.nav-link .material-symbols-rounded {
  font-size: 22px;
}

/* ═══════════════════════ FORMS ═══════════════════════ */

.input {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.15s ease;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.input::placeholder {
  color: var(--text-muted);
}

.select {
  padding: 10px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='%2364748B'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ═══════════════════════ BADGES ═══════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: var(--accent-dim);
  color: var(--accent);
}

.badge-success {
  background: var(--success-dim);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-dim);
  color: var(--warning);
}

.badge-error {
  background: var(--danger-dim);
  color: var(--danger);
}

.badge-pro {
  background: var(--brand-gradient);
  color: white;
}

/* ═══════════════════════ LOADING ═══════════════════════ */

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ═══════════════════════ TOAST ═══════════════════════ */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  opacity: 0;
  background: var(--surface-1);
  color: var(--text-primary);
  padding: 14px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-default);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast .material-symbols-rounded {
  color: var(--success);
}

/* ═══════════════════════ MODAL ═══════════════════════ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  background: var(--surface-1);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-default);
}

/* ═══════════════════════ PROGRESS BAR ═══════════════════════ */

.progress-bar {
  height: 8px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease-out;
}

/* ═══════════════════════ TIER BADGES ═══════════════════════ */

.tier-free {
  background: var(--surface-3);
  color: var(--text-muted);
}

.tier-pro {
  background: var(--brand-gradient);
  color: white;
}

.tier-power {
  background: linear-gradient(135deg, #F59E0B, #EA580C);
  color: white;
}

/* ═══════════════════════ SESSION CARDS ═══════════════════════ */

.session-card {
  transition: all 0.2s ease;
}

.session-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ═══════════════════════ KNOWLEDGE ITEMS ═══════════════════════ */

.knowledge-item {
  transition: all 0.15s ease;
}

.knowledge-item:hover {
  background: var(--surface-2);
}

.knowledge-item .delete-btn {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.knowledge-item:hover .delete-btn {
  opacity: 1;
}

/* ═══════════════════════ SCROLLBAR ═══════════════════════ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--surface-4);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ═══════════════════════ UTILITIES ═══════════════════════ */

.text-primary { color: var(--accent) !important; }
.text-secondary { color: var(--success) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-faint { color: var(--text-faint) !important; }

.bg-primary { background: var(--accent) !important; }
.bg-primary-light { background: var(--accent-dim) !important; }

/* Utility overrides for Tailwind integration */
[class*="bg-primary-light"] { background: var(--accent-dim) !important; }
[class*="text-primary"] { color: var(--accent) !important; }
.bg-secondary { background: var(--success) !important; }
.bg-secondary-light { background: var(--success-dim) !important; }

.gradient-primary {
  background: var(--brand-gradient) !important;
}

.gradient-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
}

.gradient-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%) !important;
}

/* ═══════════════════════ THEME TOGGLE ═══════════════════════ */

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--surface-4);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.toggle-track.active {
  background: var(--accent);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.toggle-track.active .toggle-thumb {
  transform: translateX(20px);
}

/* ═══════════════════════ AUTH FORMS ═══════════════════════ */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-default);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-google:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

/* ═══════════════════════ ANIMATIONS ═══════════════════════ */

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

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

.animate-fade-in {
  animation: fadeIn 0.3s ease;
}

.animate-slide-up {
  animation: slideUp 0.3s ease;
}

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

.animate-spin {
  animation: spin 1s linear infinite;
}

/* ═══════════════════════ RESPONSIVE ═══════════════════════ */

@media (max-width: 640px) {
  .stat-card {
    padding: 18px;
    gap: 14px;
  }
  
  .stat-icon {
    width: 44px;
    height: 44px;
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  .card {
    padding: 18px;
  }
}
