/* ── CSS custom properties (dark default) ──────────────────────────────────── */
:root {
  --bg:             #0f0f1a;
  --card:           #1a1a2e;
  --card-border:    #2a2a4a;
  --text:           #e0e0f0;
  --text-muted:     #8888aa;
  --label:          #aaaacc;
  --primary:        #4a9eff;
  --primary-hover:  #3385e0;
  --primary-text:   #ffffff;
  --input-bg:       #0f0f1a;
  --input-border:   #3a3a5a;
  --input-focus:    #4a9eff;
  --error-bg:       #2a1018;
  --error-border:   #c0392b;
  --error-text:     #ff7070;
  --success-bg:     #0e2a18;
  --success-border: #27ae60;
  --success-text:   #5de08a;
  --badge-bg:       #1e1e3a;
  --shadow:         0 4px 24px rgba(0,0,0,0.5);
}

[data-theme="light"] {
  --bg:             #f0f2f9;
  --card:           #ffffff;
  --card-border:    #dde1ec;
  --text:           #1a1a2e;
  --text-muted:     #666688;
  --label:          #444466;
  --primary:        #2563eb;
  --primary-hover:  #1d4ed8;
  --primary-text:   #ffffff;
  --input-bg:       #f9faff;
  --input-border:   #c8cce0;
  --input-focus:    #2563eb;
  --error-bg:       #fff0f0;
  --error-border:   #e74c3c;
  --error-text:     #c0392b;
  --success-bg:     #f0fff5;
  --success-border: #27ae60;
  --success-text:   #196b35;
  --badge-bg:       #eef0fb;
  --shadow:         0 4px 24px rgba(0,0,0,0.10);
}

/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Arial, sans-serif;
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

/* ── Auth pages (login / signup) ───────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.auth-card .subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

/* ── Profile page ──────────────────────────────────────────────────────────── */
.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--card-border);
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.app-header .user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.app-header .user-info strong {
  color: var(--text);
}

.profile-wrap {
  max-width: 600px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}

.profile-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.profile-card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--card-border);
}

.account-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.9rem;
}

.account-meta .meta-label { color: var(--text-muted); }
.account-meta .meta-value { color: var(--text); font-weight: 500; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--label);
  margin-bottom: 0.4rem;
  letter-spacing: 0.3px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--input-focus) 20%, transparent);
}

/* Theme radio group */
.theme-group {
  display: flex;
  gap: 0.75rem;
}

.theme-option {
  flex: 1;
  position: relative;
}

.theme-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  margin: 0;
}

.theme-option input[type="radio"]:checked + label {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--text);
}

/* Colour picker row */
.colour-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

input[type="color"] {
  width: 48px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  cursor: pointer;
  flex-shrink: 0;
}

.colour-preview {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--card-border);
  flex-shrink: 0;
  transition: background 0.15s;
}

.colour-hex {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: monospace;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--card-border);
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--input-border);
  background: var(--badge-bg);
}

.btn-danger {
  background: transparent;
  color: var(--error-text);
  border: 1px solid var(--error-border);
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}

.btn-danger:hover { background: var(--error-bg); }

.btn-full { width: 100%; }

/* ── Flash messages ─────────────────────────────────────────────────────────── */
.flash-error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}

.flash-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}

/* ── Account switcher hint ─────────────────────────────────────────────────── */
.switch-hint {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
}

.switch-hint a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.switch-hint a:hover { text-decoration: underline; }

/* ── Divider ────────────────────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--card-border);
  margin: 1.25rem 0;
}

/* ── Colour accent strip ────────────────────────────────────────────────────── */
.accent-strip {
  height: 4px;
  border-radius: 4px 4px 0 0;
  margin: -2rem -2rem 1.5rem -2rem;
  border-radius: 16px 16px 0 0;
}
