/* ═══════════════════════════════════════════════════════
   Quillow — Shared Dark Woodland Theme
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Crimson+Pro:ital,wght@0,400;0,600;1,400;1,600&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg:          #141a08;
  --bg2:         #1a2210;
  --sidebar:     #0d1206;
  --surface:     #1c2610;
  --surface2:    #243014;
  --surface3:    #2c3a18;
  --border:      rgba(140,200,70,0.08);
  --border2:     rgba(140,200,70,0.15);
  --shadow:      rgba(0,0,0,0.45);
  --shadow2:     rgba(0,0,0,0.25);

  --text:        #e8dab8;
  --text2:       #c4a870;
  --muted:       #7a6845;
  --faint:       #46382a;

  --gold:        #c89040;
  --gold-l:      #e0b460;
  --gold-bg:     rgba(200,144,64,0.12);
  --gold-bdr:    rgba(200,144,64,0.25);

  --green:       #5a9c3a;
  --green-l:     #78c050;
  --green-bg:    rgba(90,156,58,0.12);
  --green-bdr:   rgba(90,156,58,0.25);

  --flame:       #d96828;
  --flame-l:     #f08840;
  --flame-bg:    rgba(217,104,40,0.12);
  --flame-bdr:   rgba(217,104,40,0.28);

  --coin:        #d4a020;
  --coin-bg:     rgba(212,160,32,0.12);
  --coin-bdr:    rgba(212,160,32,0.25);

  --sidebar-w:   196px;
  --topbar-h:    64px;
  --r:           13px;
  --rs:          8px;
}

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

html { height: 100%; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: 'DM Sans', sans-serif; }
h1, h2, h3, h4, .serif { font-family: 'Playfair Display', serif; }

/* ── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ══════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 18px 14px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo img { height: 30px; width: auto; object-fit: contain; }

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--rs);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.14s;
  border: 1px solid transparent;
  background: none;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
}

.nav-item:hover { background: var(--surface); color: var(--text2); }

.nav-item.active {
  background: var(--green-bg);
  color: var(--green-l);
  border-color: var(--green-bdr);
}

.nav-item img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.14s;
}

.nav-item:hover img  { opacity: 0.8; }
.nav-item.active img { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--flame);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  line-height: 16px;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
  flex-shrink: 0;
}

.sidebar-bottom {
  border-top: 1px solid var(--border);
  padding: 12px 10px;
  flex-shrink: 0;
}

.sidebar-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 10px;
  margin-bottom: 8px;
}

.sidebar-tip img { width: 34px; height: 34px; object-fit: contain; flex-shrink: 0; }

.sidebar-tip-text { font-size: 11px; color: var(--muted); line-height: 1.5; }
.sidebar-tip-text strong { display: block; color: var(--text2); font-size: 11px; font-weight: 600; margin-bottom: 2px; }

.logout-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--rs);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.14s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.logout-btn:hover { background: var(--flame-bg); color: var(--flame-l); }
.logout-btn i { font-size: 18px; opacity: 0.6; }

/* ══════════════════════════════════════════════════════
   MAIN LAYOUT
   ══════════════════════════════════════════════════════ */
.main-layout {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── Top Bar ────────────────────────────────────────── */
.top-bar {
  height: var(--topbar-h);
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 90;
  flex-shrink: 0;
}

.topbar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--green));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  border: 2px solid var(--gold-bdr);
  cursor: pointer;
}

.topbar-user { min-width: 0; }

.topbar-greeting { font-size: 10px; color: var(--muted); line-height: 1; margin-bottom: 2px; }

.topbar-name {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-level { font-size: 10px; color: var(--muted); margin-top: 1px; }

.topbar-chips {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  flex-shrink: 0;
}

.chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.chip img { width: 16px; height: 16px; object-fit: contain; }

.chip-xp     { background: var(--green-bg); border: 1px solid var(--green-bdr); color: var(--green-l); }
.chip-coins  { background: var(--coin-bg);  border: 1px solid var(--coin-bdr);  color: var(--coin); }
.chip-streak { background: var(--flame-bg); border: 1px solid var(--flame-bdr); color: var(--flame-l); }

.topbar-icon-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 17px;
  transition: all 0.14s;
  position: relative;
  flex-shrink: 0;
  text-decoration: none;
}

.topbar-icon-btn:hover { background: var(--surface2); color: var(--text); }

.notif-dot {
  position: absolute; top: 3px; right: 3px;
  width: 7px; height: 7px;
  background: var(--flame);
  border-radius: 50%;
  border: 1.5px solid var(--sidebar);
}

/* ── Page content ───────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 22px;
  overflow-y: auto;
}

/* ══════════════════════════════════════════════════════
   COMMON COMPONENTS
   ══════════════════════════════════════════════════════ */

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 2px 16px var(--shadow);
}

.card-header {
  padding: 14px 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-title img { width: 16px; height: 16px; object-fit: contain; opacity: 0.9; }

.card-link {
  font-size: 11px;
  color: var(--muted);
  transition: color 0.14s;
  text-decoration: none;
}
.card-link:hover { color: var(--text2); }

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

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--green), var(--green-l));
  transition: width 0.7s cubic-bezier(.4,0,.2,1);
}

.progress-fill.gold   { background: linear-gradient(90deg, var(--gold), var(--gold-l)); }
.progress-fill.flame  { background: linear-gradient(90deg, var(--flame), var(--flame-l)); }
.progress-fill.coin   { background: linear-gradient(90deg, var(--coin), #f0c040); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--rs);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
}

.btn-primary  { background: var(--green); color: #fff; }
.btn-primary:hover  { opacity: 0.86; }

.btn-gold     { background: var(--gold); color: #fff; }
.btn-gold:hover     { opacity: 0.86; }

.btn-ghost {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-ghost:hover { background: var(--surface3); color: var(--text); }

.btn-flame    { background: var(--flame-bg); color: var(--flame-l); border: 1px solid var(--flame-bdr); }
.btn-flame:hover    { background: var(--flame); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: 6px; }

/* ── Circular Progress ── */
.circle-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.circle-wrap svg { transform: rotate(-90deg); }
.cp-track { fill: none; stroke: var(--bg2); stroke-width: 9; }
.cp-fill  {
  fill: none; stroke: var(--green); stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1);
}

.cp-label {
  position: absolute;
  text-align: center;
  line-height: 1.2;
}

.cp-pct {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  display: block;
}

.cp-sub { font-size: 9px; color: var(--muted); display: block; }

/* ── Streak calendar ── */
.streak-cal { display: flex; gap: 5px; }

.streak-day {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 600; color: var(--muted);
  flex-direction: column;
  gap: 1px;
}

.streak-day span { font-size: 8px; }

.streak-day.done {
  background: var(--green-bg);
  border-color: var(--green-bdr);
  color: var(--green-l);
  font-size: 13px;
}

.streak-day.today {
  border-color: var(--gold);
  color: var(--gold);
}

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

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 700;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}

.section-title img { width: 20px; height: 20px; object-fit: contain; }

/* ── Badge pill ── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
}

.pill-green  { background: var(--green-bg); color: var(--green-l); border: 1px solid var(--green-bdr); }
.pill-gold   { background: var(--gold-bg);  color: var(--gold-l);  border: 1px solid var(--gold-bdr); }
.pill-flame  { background: var(--flame-bg); color: var(--flame-l); border: 1px solid var(--flame-bdr); }
.pill-muted  { background: var(--surface2); color: var(--muted);   border: 1px solid var(--border2); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--surface2);
  border: 1px solid var(--gold-bdr);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--r);
  font-size: 13px; font-weight: 500;
  transform: translateY(80px); opacity: 0;
  transition: all 0.3s;
  z-index: 500; pointer-events: none;
  box-shadow: 0 8px 32px var(--shadow);
  max-width: 300px;
}

.toast.show { transform: translateY(0); opacity: 1; }

/* ── Spinner ── */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border2); border-top-color: var(--green);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--muted); }
.empty-state img { width: 80px; height: auto; margin: 0 auto 1rem; display: block; opacity: 0.65; }
.empty-state h3 { font-size: 18px; color: var(--text2); margin-bottom: .5rem; font-family: 'Playfair Display', serif; }
.empty-state p  { font-size: 13px; line-height: 1.7; }

/* ── Lock overlay ── */
.lock-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  border-radius: inherit;
}

.lock-overlay i { font-size: 22px; color: rgba(255,255,255,0.6); }

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 200;
  align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 18px;
  padding: 2rem; width: 100%; max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}

.modal h3 { font-family: 'Playfair Display', serif; font-size: 20px; margin-bottom: .5rem; }
.modal p  { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 1.25rem; }

/* ── Form elements ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }

.form-input {
  width: 100%; padding: 10px 13px;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--rs); color: var(--text);
  font-family: 'DM Sans', sans-serif; font-size: 14px;
  transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--green); }
.form-input::placeholder { color: var(--faint); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { width: 52px; }
  .sidebar .nav-item span, .sidebar .sidebar-tip-text, .sidebar-logo img { display: none; }
  .sidebar-logo { padding: 14px 10px; justify-content: center; display: flex; }
  .sidebar-logo::after { content: '🦔'; font-size: 22px; }
  .nav-item { justify-content: center; padding: 10px; }
  .nav-item img { width: 24px; height: 24px; }
  .sidebar-bottom { display: none; }
  :root { --sidebar-w: 52px; }
}
