@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

/* ── Dark Theme (default) ─────────────────────────────────────── */
:root {
  --bg:           #0D0D0F;
  --surface:      #161618;
  --card:         #1E1E22;
  --card-hover:   #252529;
  --border:       #2A2A30;
  --border-light: #333340;

  --text:         #F0F0F5;
  --text-muted:   #6B6B80;
  --text-dim:     #404055;

  --accent:       #6C63FF;
  --accent-glow:  rgba(108,99,255,0.25);
  --accent-dim:   rgba(108,99,255,0.12);
  --green:        #00D9A6;
  --green-glow:   rgba(0,217,166,0.2);
  --green-dim:    rgba(0,217,166,0.1);
  --danger:       #FF4F5E;
  --danger-dim:   rgba(255,79,94,0.15);
  --warning:      #FFB347;
  --warning-dim:  rgba(255,179,71,0.15);

  --nav-h:        64px;
  --mob-nav-h:    68px;
  --radius:       12px;
  --radius-lg:    18px;
  --radius-sm:    8px;

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.3);
  --shadow-glow:  0 0 32px rgba(108,99,255,0.15);
}

/* ── Light Theme ──────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:           #F2F2F8;
  --surface:      #FFFFFF;
  --card:         #FFFFFF;
  --card-hover:   #F8F8FF;
  --border:       #E2E2EE;
  --border-light: #EBEBF5;

  --text:         #12121A;
  --text-muted:   #70708A;
  --text-dim:     #C0C0D0;

  --accent:       #5A52E8;
  --accent-glow:  rgba(90,82,232,0.15);
  --accent-dim:   rgba(90,82,232,0.08);
  --green:        #00B890;
  --green-glow:   rgba(0,184,144,0.15);
  --green-dim:    rgba(0,184,144,0.08);

  --shadow:       0 4px 24px rgba(0,0,0,0.08);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.06);
  --shadow-glow:  0 0 32px rgba(90,82,232,0.1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Typography ───────────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h3 { font-size: clamp(1rem, 2.5vw, 1.25rem); }
h4 { font-size: 1rem; }

p { line-height: 1.6; }

a { color: var(--accent); text-decoration: none; }

/* ── Buttons ──────────────────────────────────────────────────── */
button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.18s ease;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all 0.18s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(108,99,255,0.3);
}
.btn-primary:hover { background: #7B74FF; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(108,99,255,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-green {
  background: var(--green);
  color: #0D0D0F;
  box-shadow: 0 4px 16px rgba(0,217,166,0.25);
}
.btn-green:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--card-hover); color: var(--text); border-color: var(--border-light); }

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(255,79,94,0.25);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 6px 14px; font-size: 0.8125rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.btn-full { width: 100%; justify-content: center; }

/* ── Form Elements ─────────────────────────────────────────────── */
input, textarea, select {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  appearance: none;
  -webkit-appearance: none;
}

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

input::placeholder, textarea::placeholder { color: var(--text-dim); }

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

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group { margin-bottom: 16px; }
.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover { border-color: var(--border-light); }
.card.interactive:hover { border-color: var(--accent); box-shadow: var(--shadow-glow); cursor: pointer; }

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

.badge-accent { background: var(--accent-dim); color: var(--accent); }
.badge-green  { background: var(--green-dim); color: var(--green); }
.badge-danger { background: var(--danger-dim); color: var(--danger); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-muted  { background: var(--border); color: var(--text-muted); }

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

.progress-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--accent);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-fill.green { background: var(--green); }
.progress-fill.danger { background: var(--danger); }
.progress-fill.warning { background: var(--warning); }

/* ── Alert Banners ────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.5;
}

.alert + .alert { margin-top: 6px; }
.alert-danger { background: var(--danger-dim); border: 1px solid rgba(255,79,94,0.25); color: var(--danger); }
.alert-warning { background: var(--warning-dim); border: 1px solid rgba(255,179,71,0.25); color: var(--warning); }
.alert-success { background: var(--green-dim); border: 1px solid rgba(0,217,166,0.25); color: var(--green); }

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

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

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

/* ── Checkbox ─────────────────────────────────────────────────── */
.checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 6px;
  border: 2px solid var(--border-light);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.18s;
  padding: 0;
}

.checkbox:checked {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 12px var(--green-glow);
}

.checkbox:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: 2px solid #0D0D0F;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* ── Mood Selector ────────────────────────────────────────────── */
.mood-picker {
  display: flex;
  gap: 10px;
}

.mood-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s;
  padding: 0;
}

.mood-btn:hover { border-color: var(--accent); transform: scale(1.1); }
.mood-btn.active { border-color: var(--accent); background: var(--accent-dim); transform: scale(1.15); box-shadow: 0 0 16px var(--accent-glow); }

/* ── Empty State ──────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { color: var(--text-dim); font-size: 1rem; margin-bottom: 8px; }
.empty-state p { font-size: 0.875rem; }

/* ── Toggle Switch ────────────────────────────────────────────── */
.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(--border-light);
  border-radius: 100px;
  cursor: pointer;
  transition: 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); background: white; }

/* ── Section Header ───────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

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

.animate-in { animation: fadeIn 0.3s ease both; }
.animate-slide { animation: slideUp 0.35s ease both; }

/* Staggered children */
.stagger > * { animation: fadeIn 0.3s ease both; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }

/* ── Spinner ──────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ── Utilities ────────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.font-display { font-family: var(--font-display); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.w-full { width: 100%; }
