/* ============================================================
   MoodTrack — design system (shared across index/login/admin)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background-color var(--t-med), color var(--t-med);
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }
svg { display: block; }

/* ── Design Tokens ───────────────────────────────────────── */
:root {
  --bg-base:        #080D18;
  --bg-surface:     #0F1828;
  --bg-elevated:    #162034;
  --bg-card:        #192540;
  --bg-card-hover:  #1E2C4A;

  --border-subtle:  rgba(255,255,255,0.04);
  --border-default: rgba(255,255,255,0.08);
  --border-strong:  rgba(255,255,255,0.14);
  --border-focus:   rgba(91,124,255,0.55);

  --text-primary:   #E8EEFF;
  --text-secondary: #AAB5CE;
  --text-muted:     #7C89A6;
  --text-inverse:   #080D18;

  --brand:          #5B7CFF;
  --brand-hover:    #7090FF;
  --brand-dark:     #3D5EE0;
  --brand-glow:     rgba(91,124,255,0.22);

  --gold:           #FFB800;
  --gold-hover:     #FFD460;
  --gold-glow:      rgba(255,184,0,0.18);
  --green:          #00D68F;
  --green-glow:     rgba(0,214,143,0.18);
  --red:            #FF5252;
  --red-glow:       rgba(255,82,82,0.18);
  --purple:         #9B6DFF;
  --purple-glow:    rgba(155,109,255,0.18);
  --orange:         #FF8C42;
  --orange-glow:    rgba(255,140,66,0.18);

  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-full: 9999px;

  --shadow-sm:    0 1px 4px rgba(0,0,0,0.35);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.45);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.55);
  --shadow-brand: 0 4px 20px rgba(91,124,255,0.35);
  --shadow-gold:  0 4px 20px rgba(255,184,0,0.3);

  --t-fast: 140ms ease;
  --t-med:  240ms ease;
  --t-slow: 380ms ease;
}

[data-theme="light"] {
  --bg-base:        #F2F4FA;
  --bg-surface:     #FFFFFF;
  --bg-elevated:    #F7F9FC;
  --bg-card:        #FFFFFF;
  --bg-card-hover:  #EEF1F8;

  --border-subtle:  rgba(16,25,46,0.05);
  --border-default: rgba(16,25,46,0.10);
  --border-strong:  rgba(16,25,46,0.18);

  --text-primary:   #10192E;
  --text-secondary: #56617A;
  --text-muted:     #8791A8;

  --shadow-sm:    0 1px 4px rgba(16,25,46,0.06);
  --shadow-md:    0 4px 16px rgba(16,25,46,0.08);
  --shadow-lg:    0 8px 32px rgba(16,25,46,0.12);
}

/* ── Page shell ──────────────────────────────────────────── */
.page-shell {
  width: 100%; min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
  background: var(--bg-base);
  background-image: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(91,124,255,0.14), transparent);
}

.theme-toggle {
  position: fixed; top: 18px; right: 18px;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--r-md); cursor: pointer;
  transition: all var(--t-fast); color: var(--text-secondary);
  z-index: 40;
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle:hover { background: var(--gold-glow); color: var(--gold); border-color: var(--gold); }

/* ── Brand mark ──────────────────────────────────────────── */
.brand-block { text-align: center; margin-bottom: 26px; }
.brand-logo {
  width: 56px; height: 56px;
  background: var(--brand); border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; box-shadow: var(--shadow-brand);
}
.brand-logo svg { width: 28px; height: 28px; color: white; }
.brand-title { font-size: 22px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.4px; }
.brand-sub   { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  animation: pageEnter 0.4s ease;
}
.card--form { max-width: 480px; width: 100%; }
.card--narrow { max-width: 400px; }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--r-lg);
  padding: 20px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--r-md);
  font-size: 14px; font-weight: 600;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn--primary { background: var(--brand); color: white; box-shadow: var(--shadow-brand); }
.btn--primary:hover:not(:disabled) { background: var(--brand-hover); transform: translateY(-1px); box-shadow: 0 6px 24px rgba(91,124,255,0.45); }
.btn--primary:active:not(:disabled) { transform: translateY(0); }

.btn--secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-default); }
.btn--secondary:hover:not(:disabled) { background: var(--bg-card-hover); border-color: var(--border-strong); }

.btn--ghost { background: transparent; color: var(--text-secondary); }
.btn--ghost:hover:not(:disabled) { background: var(--bg-elevated); color: var(--text-primary); }

.btn--danger { background: var(--red-glow); color: var(--red); border: 1px solid var(--red); }
.btn--danger:hover:not(:disabled) { background: var(--red); color: white; }

.btn--full { width: 100%; }
.btn--sm { padding: 7px 14px; font-size: 13px; }
.btn--lg { padding: 13px 28px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-label  { font-size: 13px; font-weight: 600; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.required { color: var(--red); }

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: var(--r-md); color: var(--text-primary);
  font-size: 14px; outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

/* ── Alert banners ───────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 13px; line-height: 1.5;
  margin-bottom: 16px;
  animation: slideDown 0.25s ease;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert--success { background: var(--green-glow); border: 1px solid rgba(0,214,143,0.3); color: var(--green); }
.alert--error   { background: var(--red-glow); border: 1px solid rgba(255,82,82,0.3); color: var(--red); }
.alert--info    { background: var(--brand-glow); border: 1px solid rgba(91,124,255,0.3); color: var(--brand); }
.alert--warn    { background: var(--gold-glow); border: 1px solid rgba(255,184,0,0.3); color: var(--gold); }
.alert-text strong { display: block; margin-bottom: 2px; color: inherit; }
.alert-text span { color: var(--text-secondary); }

/* ── Mood selector ───────────────────────────────────────── */
.mood-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mood-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 8px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-default);
  border-radius: var(--r-lg);
  transition: all var(--t-fast);
  color: var(--text-secondary);
}
.mood-btn:hover { background: var(--bg-card-hover); border-color: var(--border-strong); transform: translateY(-2px); }
.mood-btn-icon {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-full);
  background: var(--bg-card);
  color: var(--text-muted);
  transition: all var(--t-fast);
}
.mood-btn-icon svg { width: 20px; height: 20px; }
.mood-btn-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }

.mood-btn[data-tone="red"].active    { border-color: var(--red); background: var(--red-glow); }
.mood-btn[data-tone="red"].active .mood-btn-icon    { background: var(--red); color: white; }
.mood-btn[data-tone="red"].active .mood-btn-label   { color: var(--red); }

.mood-btn[data-tone="orange"].active { border-color: var(--orange); background: var(--orange-glow); }
.mood-btn[data-tone="orange"].active .mood-btn-icon { background: var(--orange); color: white; }
.mood-btn[data-tone="orange"].active .mood-btn-label { color: var(--orange); }

.mood-btn[data-tone="muted"].active  { border-color: var(--text-muted); background: var(--bg-card-hover); }
.mood-btn[data-tone="muted"].active .mood-btn-icon  { background: var(--text-muted); color: var(--bg-base); }
.mood-btn[data-tone="muted"].active .mood-btn-label { color: var(--text-primary); }

.mood-btn[data-tone="brand"].active  { border-color: var(--brand); background: var(--brand-glow); }
.mood-btn[data-tone="brand"].active .mood-btn-icon  { background: var(--brand); color: white; }
.mood-btn[data-tone="brand"].active .mood-btn-label { color: var(--brand); }

.mood-btn[data-tone="green"].active  { border-color: var(--green); background: var(--green-glow); }
.mood-btn[data-tone="green"].active .mood-btn-icon  { background: var(--green); color: white; }
.mood-btn[data-tone="green"].active .mood-btn-label { color: var(--green); }

.mood-btn[data-tone="gold"].active   { border-color: var(--gold); background: var(--gold-glow); }
.mood-btn[data-tone="gold"].active .mood-btn-icon   { background: var(--gold); color: var(--text-inverse); }
.mood-btn[data-tone="gold"].active .mood-btn-label  { color: var(--gold); }

/* ── Slider ──────────────────────────────────────────────── */
.slider-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.slider-value {
  background: var(--brand); color: white;
  padding: 3px 11px; border-radius: var(--r-full);
  font-weight: 700; font-size: 13px; min-width: 30px; text-align: center;
}
.slider-wrapper { padding: 4px 0 0; }
input[type="range"] {
  width: 100%; height: 6px; border-radius: var(--r-full);
  background: var(--border-default); outline: none;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand); cursor: pointer;
  box-shadow: 0 2px 8px rgba(91,124,255,0.5);
  border: 3px solid var(--bg-surface);
  transition: transform var(--t-fast);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand); cursor: pointer; border: 3px solid var(--bg-surface);
  box-shadow: 0 2px 8px rgba(91,124,255,0.5);
}
.slider-marks { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 8px; }

/* ── Checkboxes ──────────────────────────────────────────── */
.checkbox-group { display: flex; flex-direction: column; gap: 4px; }
.checkbox-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.checkbox-item:hover { background: var(--bg-card-hover); }
.checkbox-item input[type="checkbox"] {
  width: 17px; height: 17px; cursor: pointer; accent-color: var(--brand); flex-shrink: 0;
}
.checkbox-item label { cursor: pointer; font-size: 13px; color: var(--text-secondary); }

/* ── Section titles ──────────────────────────────────────── */
.section-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; color: var(--brand);
  text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 14px;
}
.section-title svg { width: 14px; height: 14px; }
.divider { height: 1px; background: var(--border-default); margin: 16px 0; }

/* ── Links ───────────────────────────────────────────────── */
.link-row { display: flex; justify-content: center; margin-top: 18px; }
.text-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  transition: color var(--t-fast);
}
.text-link svg { width: 14px; height: 14px; }
.text-link:hover { color: var(--brand); }

/* ── Badges / chips ──────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
}
.badge--red    { background: var(--red-glow); color: var(--red); }
.badge--orange { background: var(--orange-glow); color: var(--orange); }
.badge--muted  { background: var(--bg-card-hover); color: var(--text-secondary); }
.badge--brand  { background: var(--brand-glow); color: var(--brand); }
.badge--green  { background: var(--green-glow); color: var(--green); }
.badge--gold   { background: var(--gold-glow); color: var(--gold); }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; margin: 2px 3px 0 0;
  border-radius: var(--r-full);
  background: var(--brand-glow); color: var(--brand);
  font-size: 11px; font-weight: 600;
}

/* ── Keyframes ───────────────────────────────────────────── */
@keyframes pageEnter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin      { to { transform: rotate(360deg); } }

/* ── Utilities ───────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
  .card { padding: 26px 20px; }
  .mood-grid { gap: 8px; }
  .mood-btn { padding: 12px 6px; }
}
