/* ==========================================================================
   NurseCoach — "Nightshift Violet" theme + dashboard shell
   Loaded after styles.css: repaints the palette and adds the sidebar layout,
   progress rings, rails, goals, auth modal, and usage meter.
   ========================================================================== */

:root {
  --bg: #f3f2fb;
  --surface: #ffffff;
  --surface-2: #f4f2fd;
  --ink: #211d35;
  --ink-soft: #6b6685;
  --muted: #8b87a3;

  --primary: #7c5cff;
  --primary-600: #6a4bf0;
  --primary-700: #5a3ddd;
  --primary-050: #efeaff;

  --accent: #f472b6;
  --green: #10b981;
  --green-050: #e7f9f2;
  --red: #ef4444;
  --red-050: #fdecec;
  --amber: #f59e0b;

  --border: #e7e4f4;
  --border-strong: #d6d1ec;

  --side-bg: #17142a;
  --side-ink: #b9b4d4;
  --side-active: #241f40;
  --ring-track: #e7e4f4;

  --shadow-sm: 0 1px 2px rgba(38, 24, 90, 0.06);
  --shadow: 0 8px 24px rgba(38, 24, 90, 0.10);
  --shadow-lg: 0 20px 52px rgba(38, 24, 90, 0.18);
}

/* Ambient blobs → violet/pink */
body::before { background: radial-gradient(circle, #d8ccff 0%, transparent 65%); }
body::after { background: radial-gradient(circle, #fbd8ee 0%, transparent 65%); }

/* ------------------------------------------------------------------ shell */

body.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--side-bg);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 14px;
  z-index: 50;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  cursor: pointer;
  padding: 4px 8px;
}
.side-brand .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.side-brand .brand-name { font-weight: 700; font-size: 16.5px; letter-spacing: -0.01em; }
.side-brand .brand-accent { color: #c4b5fd; }

.side-user {
  border: 1px solid #2c2749;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1d1936;
}
.side-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
}
.side-user-name { color: #fff; font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.side-user-sub { font-size: 11px; color: var(--side-ink); }
.side-user-sub button { background: none; border: none; color: #a78bfa; cursor: pointer; padding: 0; font-size: 11px; text-decoration: underline; }
.side-signin {
  width: 100%;
  border: 1px dashed #3a3462;
  background: none;
  color: #c4b5fd;
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
}
.side-signin:hover { border-color: var(--primary); color: #fff; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  border-radius: 11px;
  background: none;
  color: var(--side-ink);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.side-link:hover { background: var(--side-active); color: #fff; transform: translateX(2px); }
.side-link.active { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(124, 92, 255, 0.4); }
.side-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border-radius: 9px;
  min-width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.side-meter {
  margin-top: auto;
  border: 1px solid #2c2749;
  background: #1d1936;
  border-radius: 14px;
  padding: 12px;
  font-size: 12px;
  display: grid;
  gap: 8px;
}
.meter-title { color: #fff; font-weight: 600; font-size: 12px; display: flex; justify-content: space-between; }
.meter-row { display: grid; gap: 3px; }
.meter-label { display: flex; justify-content: space-between; color: var(--side-ink); }
.meter-bar { height: 5px; border-radius: 3px; background: #2c2749; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.6s cubic-bezier(0.16,1,0.3,1); }
.meter-pro-note { color: #a78bfa; text-align: center; }

.side-foot { display: grid; gap: 8px; }
.side-pro { width: 100%; }
.side-reset {
  background: none;
  border: none;
  color: #6b6488;
  font-size: 11.5px;
  cursor: pointer;
  font-family: var(--font);
  text-decoration: underline;
}

/* ---------------------------------------------------------------- topbar */

.main-col { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  background: rgba(243, 242, 251, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 26px;
  z-index: 40;
}
.top-greet { font-weight: 600; font-size: 14.5px; color: var(--ink-soft); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.streak-chip {
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.streak-chip b { color: var(--primary-700); }
.hamburger { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--ink); }

/* --------------------------------------------------- dashboard with rail */

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
}
.dash-rail { display: grid; gap: 16px; position: sticky; top: 74px; }

.rail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  padding: 16px;
}
.rail-title { font-weight: 700; font-size: 14px; margin: 0 0 10px; display: flex; align-items: center; justify-content: space-between; }
.rail-title .pct { color: var(--primary-700); }

.cp-list { display: grid; gap: 0; position: relative; }
.cp {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 7px 0;
  position: relative;
}
.cp::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 26px;
  bottom: -8px;
  width: 2px;
  background: var(--border);
}
.cp:last-child::before { display: none; }
.cp-dot {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: #fff;
  flex: 0 0 21px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  z-index: 1;
  transition: all 0.3s ease;
}
.cp.done .cp-dot { background: var(--primary); border-color: var(--primary); }
.cp-label { font-size: 13px; font-weight: 600; line-height: 1.25; }
.cp-hint { font-size: 11.5px; color: var(--ink-soft); }
.cp.done .cp-label { color: var(--primary-700); }

.goal-ring-wrap { display: flex; gap: 14px; align-items: center; }
.goal-list { display: grid; gap: 6px; font-size: 12.5px; flex: 1; }
.goal-item { display: flex; align-items: center; gap: 7px; color: var(--ink-soft); }
.goal-item.done { color: var(--ink); }
.goal-check {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff; flex: 0 0 16px;
}
.goal-item.done .goal-check { background: var(--green); border-color: var(--green); }

.ring-text { font-size: 13px; font-weight: 700; fill: var(--ink); font-family: var(--font); }
.ring-fill { transition: stroke-dashoffset 0.8s cubic-bezier(0.16, 1, 0.3, 1); }

/* hero (continue studying) */
.dash-hero {
  background: linear-gradient(120deg, #1d1936 0%, #3b2d73 60%, #7c5cff 130%);
  color: #fff;
  border-radius: 20px;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.dash-hero .lesson-hero-art { background: rgba(255, 255, 255, 0.12); box-shadow: none; }
.dash-hero-body { flex: 1; min-width: 0; }
.dash-hero-eyebrow { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: #c4b5fd; font-weight: 700; }
.dash-hero-title { font-family: var(--display); font-size: 22px; margin: 3px 0 4px; }
.dash-hero-sub { font-size: 13px; color: #ddd6fe; margin: 0; }
.dash-hero .btn-primary { background: #fff; color: var(--primary-700); }
.dash-hero .btn-primary:hover { box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3); }

/* topic cards get progress rings */
.topic-ring { margin-left: auto; flex: 0 0 auto; }
.topic-card .notes-badge { position: absolute; top: 10px; right: 10px; }
.topic-card { position: relative; }

/* stats strip */
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 4px 0 18px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}
.stat-num { font-size: 22px; font-weight: 700; color: var(--primary-700); font-family: var(--display); }
.stat-label { font-size: 12px; color: var(--ink-soft); }

/* ------------------------------------------------------------ auth modal */

.auth-overlay {
  position: fixed; inset: 0; z-index: 85;
  background: rgba(23, 20, 42, 0.6);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: fade-in 0.25s ease both;
}
.auth-panel {
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 26px 26px 20px;
  animation: slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  position: relative;
}
.auth-close { position: absolute; top: 12px; right: 14px; border: none; background: none; font-size: 16px; color: var(--ink-soft); cursor: pointer; }
.auth-title { font-family: var(--display); margin: 0 0 2px; font-size: 22px; }
.auth-sub { color: var(--ink-soft); font-size: 13px; margin: 0 0 14px; }
.auth-form { display: grid; gap: 10px; }
.auth-form input {
  padding: 11px 13px;
  border: 1.5px solid var(--border-strong);
  border-radius: 11px;
  font-family: var(--font);
  font-size: 14px;
  background: var(--surface-2);
}
.auth-form input:focus { outline: none; border-color: var(--primary); background: #fff; }
.auth-error { color: var(--red); font-size: 12.5px; min-height: 16px; margin: 0; }
.auth-switch { text-align: center; font-size: 12.5px; color: var(--ink-soft); margin-top: 10px; }
.auth-switch button { background: none; border: none; color: var(--primary-700); cursor: pointer; text-decoration: underline; font-size: 12.5px; }
.auth-note { font-size: 11px; color: var(--muted); text-align: center; margin-top: 8px; }

/* review mode banner */
.review-banner {
  background: linear-gradient(120deg, var(--primary-050), #fdf2fa);
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 13.5px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.confetti-canvas { position: fixed; inset: 0; z-index: 95; pointer-events: none; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1060px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-rail { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); display: grid; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  body.shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 246px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  body.side-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .hamburger { display: block; }
}

/* fixups */
.side-brand .brand-name { color: #fff; }
.side-brand .brand-name .brand-accent { color: #c4b5fd; }
