@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

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

:root {
  --bg:         #F4F1FF;
  --surface:    #FFFFFF;
  --surface2:   #F0EEFF;
  --border:     #E2DCFF;
  --text:       #1A1035;
  --text-muted: #6E6A8A;
  --text-dim:   #B0ABCC;

  /* Vibrant accent palette */
  --accent:     #6C47FF;
  --accent2:    #FF6B9D;
  --accent3:    #FFB347;
  --success:    #00C896;
  --warning:    #FF9F1C;
  --danger:     #FF4D6D;
  --sky:        #38BFFF;
  --mint:       #00D4AA;
  --lavender:   #A78BFA;

  --font:   'Plus Jakarta Sans', sans-serif;
  --mono:   'JetBrains Mono', monospace;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(108,71,255,0.10);
  --shadow-lg: 0 12px 48px rgba(108,71,255,0.18);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse at 10% 0%, rgba(108,71,255,0.07) 0%, transparent 60%),
    radial-gradient(ellipse at 90% 100%, rgba(255,107,157,0.07) 0%, transparent 60%);
}

/* ── NAV ── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.80);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 64px;
  box-shadow: 0 2px 16px rgba(108,71,255,0.07);
}

.nav-brand {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.nav-brand span {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links { display: flex; gap: 0.25rem; flex: 1; }

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: 99px;
  transition: all 0.18s;
}
.nav-links a:hover { color: var(--accent); background: rgba(108,71,255,0.08); }
.nav-links a.active {
  color: var(--accent);
  background: rgba(108,71,255,0.12);
}

/* ── USER MENU ── */
.user-menu { margin-left: auto; position: relative; }

.user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.28rem 0.75rem 0.28rem 0.32rem;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 700;
  transition: all 0.18s;
  box-shadow: 0 2px 8px rgba(108,71,255,0.08);
}
.user-menu-toggle:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(108,71,255,0.16);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.user-name { max-width: 135px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 220px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
}

.user-menu-name { font-size: 0.875rem; font-weight: 800; color: var(--text); }
.user-menu-email { margin-top: 0.2rem; font-size: 0.75rem; color: var(--text-muted); word-break: break-word; }

.user-save-btn,
.user-save-logout-btn {
  margin-top: 0.6rem;
  width: 100%;
  border: 1.5px solid rgba(108,71,255,0.25);
  background: rgba(108,71,255,0.08);
  color: var(--accent);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.user-save-btn:hover,
.user-save-logout-btn:hover { background: rgba(108,71,255,0.15); }

.user-logout-btn {
  margin-top: 0.5rem;
  width: 100%;
  border: 1.5px solid rgba(255,77,109,0.25);
  background: rgba(255,77,109,0.08);
  color: var(--danger);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.user-logout-btn:hover { background: rgba(255,77,109,0.16); }

/* ── PAGE ── */
.page { max-width: 1280px; margin: 0 auto; padding: 2.5rem 2rem; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow);
}
.card:hover {
  border-color: rgba(108,71,255,0.2);
  box-shadow: var(--shadow-lg);
}
.card--interactive:hover { transform: translateY(-3px); }

/* Colourful card accents — top border stripe */
.card-violet  { border-top: 3px solid var(--accent); }
.card-pink    { border-top: 3px solid var(--accent2); }
.card-amber   { border-top: 3px solid var(--accent3); }
.card-green   { border-top: 3px solid var(--success); }
.card-sky     { border-top: 3px solid var(--sky); }

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; }

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-5 { grid-template-columns: 1fr; }
  .page { padding: 1.5rem 1rem; }
  nav { padding: 0 1rem; gap: 1rem; }
}

/* ── TYPOGRAPHY ── */
h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 1rem; font-weight: 600; }
.label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.mono { font-family: var(--mono); }

/* ── STAT BLOCK ── */
.stat-value {
  font-family: var(--mono);
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1;
}
.stat-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }

/* ── PROGRESS BAR ── */
.progress-track {
  background: var(--surface2);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
  background: linear-gradient(90deg, var(--accent), var(--lavender));
}
.progress-fill.success { background: linear-gradient(90deg, var(--success), var(--mint)); }
.progress-fill.warning { background: linear-gradient(90deg, var(--warning), var(--accent3)); }
.progress-fill.danger  { background: linear-gradient(90deg, var(--danger),  var(--accent2)); }

/* ── BADGE ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.7rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-blue   { background: rgba(108,71,255,0.12); color: var(--accent);  }
.badge-green  { background: rgba(0,200,150,0.12);  color: var(--success); }
.badge-orange { background: rgba(255,159,28,0.15); color: var(--warning); }
.badge-red    { background: rgba(255,77,109,0.12); color: var(--danger);  }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: 99px;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--lavender));
  color: #fff;
  box-shadow: 0 4px 14px rgba(108,71,255,0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(108,71,255,0.45);
}
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: var(--accent); }
.btn-danger {
  background: rgba(255,77,109,0.1);
  color: var(--danger);
  border: 1.5px solid rgba(255,77,109,0.25);
}
.btn-danger:hover { background: rgba(255,77,109,0.18); }

/* ── INPUT ── */
.input-group { display: flex; flex-direction: column; gap: 0.4rem; }
.input-group label { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); }

input[type="number"], input[type="text"], textarea, select {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.6rem 0.9rem;
  width: 100%;
  transition: border-color 0.18s, box-shadow 0.18s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,71,255,0.12);
}

/* ── CHECKLIST ── */
.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
}
.checklist-item:hover {
  background: var(--surface2);
  border-color: var(--accent);
  transform: translateX(3px);
}
.checklist-item.completed { opacity: 0.55; }
.checklist-item.completed .item-name { text-decoration: line-through; color: var(--text-muted); }

.check-box {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.18s;
  font-size: 12px;
}
.check-box.done {
  border-color: var(--success);
  background: linear-gradient(135deg, var(--success), var(--mint));
  color: #fff;
}

/* ── RING ── */
.ring-container { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.ring-label { position: absolute; text-align: center; font-family: var(--mono); }

/* ── HEATMAP ── */
.heatmap { display: flex; gap: 3px; flex-wrap: wrap; }
.heat-cell {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--surface2);
  transition: transform 0.1s;
  cursor: default;
  position: relative;
}
.heat-cell:hover { transform: scale(1.3); }
.heat-cell:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  font-size: 0.65rem;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 99;
  font-family: var(--mono);
}
.heat-0 { background: var(--surface2); }
.heat-1 { background: rgba(108,71,255,0.20); }
.heat-2 { background: rgba(108,71,255,0.42); }
.heat-3 { background: rgba(108,71,255,0.68); }
.heat-4 { background: var(--accent); }

/* ── ROLLOVER ALERT ── */
.rollover-alert {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(255,159,28,0.35);
  background: rgba(255,159,28,0.08);
  margin-bottom: 1.5rem;
  font-weight: 600;
}
.rollover-alert.good {
  border-color: rgba(0,200,150,0.35);
  background: rgba(0,200,150,0.08);
}

/* ── NOTES BOX ── */
.notes-box {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  font-size: 0.9rem;
  line-height: 1.8;
  white-space: pre-wrap;
  color: var(--text);
  min-height: 120px;
}
.notes-empty { color: var(--text-dim); font-style: italic; }

/* ── Q&A ── */
.qa-item {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 0.75rem;
  transition: border-color 0.18s;
}
.qa-item:hover { border-color: var(--accent); }
.qa-question {
  padding: 0.9rem 1rem;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface2);
  transition: background 0.15s;
  user-select: none;
}
.qa-question:hover { background: #EBE8FF; }
.qa-answer {
  padding: 0.9rem 1rem;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  display: none;
  background: var(--surface);
}
.qa-answer.open { display: block; }
.qa-chevron { transition: transform 0.2s; font-size: 0.75rem; }
.qa-chevron.open { transform: rotate(180deg); }

/* ── SUBJECT CARD ── */
.subject-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-decoration: none;
  color: var(--text);
  position: relative;
  overflow: hidden;
}
.subject-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  border-radius: 16px 16px 0 0;
}
.subject-card .icon { font-size: 2rem; }
.subject-card .s-name { font-weight: 700; font-size: 0.95rem; }
.subject-card .s-count { font-size: 0.8rem; color: var(--text-muted); font-family: var(--mono); }
.subject-card .s-pct { font-family: var(--mono); font-weight: 700; font-size: 0.9rem; }

/* ── BREADCRUMB ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--accent); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--text-dim); }

/* ── SECTION HEADER ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

/* ── LOG LIST ── */
.log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.log-item:last-child { border-bottom: none; }
.log-date { color: var(--text-muted); font-family: var(--mono); }
.log-hours { font-family: var(--mono); font-weight: 700; }

/* ── DASHBOARD-SPECIFIC ── */
.dashboard-hero {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media(max-width:820px){ .dashboard-hero { grid-template-columns: 1fr; } }

.today-card { display: flex; flex-direction: column; gap: 1.25rem; }

.hours-row { display: flex; align-items: flex-end; gap: 1rem; }

.big-input {
  font-family: var(--mono);
  font-size: 3rem;
  font-weight: 700;
  background: transparent;
  border: none;
  border-bottom: 2.5px solid var(--border);
  border-radius: 0;
  color: var(--accent);
  width: 120px;
  padding: 0;
  line-height: 1;
  transition: border-color 0.18s;
}
.big-input:focus { outline: none; border-color: var(--accent); }

.streak-flame {
  font-size: 1rem;
  background: linear-gradient(135deg, rgba(255,159,28,0.15), rgba(255,77,109,0.10));
  border: 1.5px solid rgba(255,159,28,0.3);
  border-radius: 99px;
  padding: 0.3rem 0.75rem;
  font-weight: 700;
  color: var(--warning);
}

.subjects-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 0.85rem; }

.subj-mini {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-decoration: none;
  color: var(--text);
  padding: 0.85rem;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  transition: all 0.18s;
  position: relative;
  background: var(--surface);
}
.subj-mini:hover {
  background: var(--surface2);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(108,71,255,0.12);
}
.subj-mini-name { font-size: 0.78rem; font-weight: 700; }
.subj-mini-pct  { font-family: var(--mono); font-size: 0.75rem; font-weight: 600; }

.log-controls { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }

/* Calendar */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 0.75rem; }

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  font-size: 0.75rem;
  position: relative;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.cal-day:hover:not(.other-month) {
  background: rgba(108,71,255,0.08);
  border-color: var(--accent);
  transform: scale(1.05);
}
.cal-day.today {
  border-color: var(--accent);
  border-width: 2px;
  background: rgba(108,71,255,0.06);
  font-weight: 800;
  color: var(--accent);
}
.cal-day.has-hours {
  background: linear-gradient(135deg, var(--success), var(--mint));
  border-color: transparent;
  color: white;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,200,150,0.3);
}
.cal-day.logged-zero {
  background: rgba(255,159,28,0.12);
  border-color: rgba(255,159,28,0.4);
}
.cal-day.other-month { opacity: 0.25; cursor: default; }

.cal-hours  { font-size: 0.6rem; margin-top: 2px; font-family: var(--mono); }
.cal-missed { font-size: 0.6rem; margin-top: 2px; font-family: var(--mono); color: var(--danger); }
.cal-left   { font-size: 0.6rem; margin-top: 2px; font-family: var(--mono); color: var(--warning); }
.cal-header { font-weight: 700; font-size: 0.7rem; color: var(--text-muted); padding: 0.5rem 0; text-align: center; }

/* Modal */
.modal {
  display: none;
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(26,16,53,0.35);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center; justify-content: center;
}
.modal.open { display: flex; }
.modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  border: 1.5px solid var(--border);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.25rem;
}
.modal-close {
  background: none; border: none;
  font-size: 1.4rem; cursor: pointer;
  color: var(--text-muted);
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.45s cubic-bezier(0.22,1,0.36,1) both; }
.delay-1 { animation-delay: 0.06s; }
.delay-2 { animation-delay: 0.12s; }
.delay-3 { animation-delay: 0.18s; }
.delay-4 { animation-delay: 0.24s; }

/* ── DIVIDER ── */
.divider { border: none; border-top: 1.5px solid var(--border); margin: 1.5rem 0; }
