/* ============================================================
   MASSAR — STUDY TRACKER | Design System
   ============================================================ */

:root {
  /* Color Palette */
  --bg-base: #0a0d14;
  --bg-card: #111622;
  --bg-elevated: #161d2e;
  --bg-glass: rgba(22, 29, 46, 0.7);
  --bg-input: #1a2235;

  --accent-primary: #5b6ef5;
  --accent-secondary: #7c5cbf;
  --accent-success: #2ecc8a;
  --accent-warn: #f5a623;
  --accent-danger: #e05555;
  --accent-info: #3fb8f0;

  --gradient-main: linear-gradient(135deg, #5b6ef5 0%, #7c5cbf 100%);
  --gradient-success: linear-gradient(135deg, #2ecc8a 0%, #00b377 100%);
  --gradient-warm: linear-gradient(135deg, #f5a623 0%, #e0823e 100%);
  --gradient-danger: linear-gradient(135deg, #e05555 0%, #c0392b 100%);

  --text-primary: #eef0f8;
  --text-secondary: #8a94b8;
  --text-muted: #4a5278;
  --text-accent: #a0aaff;

  --border: rgba(90, 100, 160, 0.2);
  --border-hover: rgba(91, 110, 245, 0.5);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 24px rgba(91, 110, 245, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --font-main: "Cairo", "Tajawal", sans-serif;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  direction: rtl;
  overflow-x: hidden;
}

/* ── Scrollbar ─────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: var(--radius-full);
}

/* ============================================================
   SPLASH SCREEN
   ============================================================ */
.splash {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  z-index: 9999;
  transition:
    opacity 0.5s ease,
    visibility 0.5s ease;
}
.splash.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-logo {
  text-align: center;
}
.splash-icon {
  font-size: 72px;
  animation: float 2s ease-in-out infinite;
  display: block;
  margin-bottom: 16px;
}
.splash-title {
  font-size: 52px;
  font-weight: 900;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}
.splash-sub {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 8px;
  font-weight: 400;
}
.splash-loader {
  width: 200px;
  height: 3px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.loader-bar {
  height: 100%;
  background: var(--gradient-main);
  border-radius: var(--radius-full);
  animation: load 1.4s ease forwards;
}

/* ============================================================
   LAYOUT
   ============================================================ */
#main-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────── */
#sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 28px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-icon {
  font-size: 28px;
}
.brand-name {
  font-size: 22px;
  font-weight: 900;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-date {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  padding: 16px 20px 6px;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  border-radius: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  border-right: 3px solid transparent;
  position: relative;
}
.nav-item:hover {
  color: var(--text-primary);
  background: rgba(91, 110, 245, 0.08);
}
.nav-item.active {
  color: var(--accent-primary);
  background: rgba(91, 110, 245, 0.12);
  border-right-color: var(--accent-primary);
}
.nav-item .nav-icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
}
.nav-badge {
  margin-right: auto;
  background: var(--accent-danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.btn-setup {
  width: 100%;
  padding: 11px;
  background: var(--gradient-main);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.3px;
}
.btn-setup:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

/* ── Main Content ─────────────────────────── */
#main-content {
  margin-right: 260px;
  flex: 1;
  padding: 32px;
  min-height: 100vh;
}

/* ── Mobile Menu Toggle ──────────────────── */
#menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-primary);
}

/* ============================================================
   PAGE VIEWS
   ============================================================ */
.page-view {
  display: none;
  animation: fadeIn 0.3s ease;
}
.page-view.active {
  display: block;
}

/* ── Page Header ─────────────────────────── */
.page-header {
  margin-bottom: 28px;
}
.page-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   TODAY VIEW
   ============================================================ */
.missed-alert {
  background: linear-gradient(
    135deg,
    rgba(224, 85, 85, 0.15),
    rgba(192, 57, 43, 0.08)
  );
  border: 1px solid rgba(224, 85, 85, 0.35);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  animation: slideDown 0.4s ease;
}
.missed-alert-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}
.missed-alert-content h3 {
  font-size: 15px;
  font-weight: 700;
  color: #e05555;
  margin-bottom: 4px;
}
.missed-alert-content p {
  font-size: 13px;
  color: var(--text-secondary);
}
.missed-alert-action {
  margin-right: auto;
  flex-shrink: 0;
  background: rgba(224, 85, 85, 0.2);
  border: 1px solid rgba(224, 85, 85, 0.4);
  color: #e05555;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.missed-alert-action:hover {
  background: rgba(224, 85, 85, 0.3);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition);
}
.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.blue {
  background: rgba(91, 110, 245, 0.15);
}
.stat-icon.green {
  background: rgba(46, 204, 138, 0.15);
}
.stat-icon.orange {
  background: rgba(245, 166, 35, 0.15);
}
.stat-icon.red {
  background: rgba(224, 85, 85, 0.15);
}
.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 400;
}

/* Task List */
.tasks-section {
  margin-bottom: 24px;
}
.tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.tasks-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tasks-progress-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.progress-bar-wrap {
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  height: 6px;
  margin-bottom: 18px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--gradient-success);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.task-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition);
  cursor: default;
}
.task-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-elevated);
}
.task-item.is-main {
  border-right: 3px solid var(--accent-primary);
}
.task-item.is-done {
  opacity: 0.55;
}
.task-item.is-done .task-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-check {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
  font-size: 14px;
}
.task-check:hover {
  border-color: var(--accent-success);
}
.task-check.done {
  background: var(--gradient-success);
  border-color: transparent;
}
.task-check.in-progress {
  background: rgba(245, 166, 35, 0.2);
  border-color: var(--accent-warn);
}

.task-info {
  flex: 1;
  min-width: 0;
}
.task-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}
.task-subject {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}
.task-badge {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}
.task-badge.main {
  background: rgba(91, 110, 245, 0.15);
  color: var(--accent-primary);
}
.task-badge.sub {
  background: rgba(138, 148, 184, 0.12);
  color: var(--text-secondary);
}
.task-badge.done {
  background: rgba(46, 204, 138, 0.15);
  color: var(--accent-success);
}
.task-badge.missed {
  background: rgba(224, 85, 85, 0.15);
  color: var(--accent-danger);
}
.task-badge.progress {
  background: rgba(245, 166, 35, 0.15);
  color: var(--accent-warn);
}

.task-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.btn-task-action {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  transition: all var(--transition);
}
.btn-done-task {
  background: rgba(46, 204, 138, 0.1);
  border-color: rgba(46, 204, 138, 0.3);
  color: var(--accent-success);
}
.btn-done-task:hover {
  background: rgba(46, 204, 138, 0.2);
}
.btn-progress-task {
  background: rgba(245, 166, 35, 0.1);
  border-color: rgba(245, 166, 35, 0.3);
  color: var(--accent-warn);
}
.btn-progress-task:hover {
  background: rgba(245, 166, 35, 0.2);
}
.btn-reset-task {
  background: rgba(138, 148, 184, 0.1);
  border-color: rgba(138, 148, 184, 0.2);
  color: var(--text-secondary);
}
.btn-reset-task:hover {
  background: rgba(138, 148, 184, 0.2);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state .empty-icon {
  font-size: 52px;
  margin-bottom: 16px;
}
.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}
.empty-state p {
  font-size: 14px;
}

/* ============================================================
   SUBJECTS SETUP PAGE
   ============================================================ */
.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 24px;
}

.subjects-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.subject-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
  cursor: pointer;
}
.subject-chip:hover {
  border-color: var(--border-hover);
}
.subject-chip-icon {
  font-size: 22px;
}
.subject-chip-info {
  flex: 1;
}
.subject-chip-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.subject-chip-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.subject-chip-actions {
  display: flex;
  gap: 6px;
}
.btn-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.btn-icon.edit {
  background: rgba(91, 110, 245, 0.15);
  color: var(--accent-primary);
}
.btn-icon.edit:hover {
  background: rgba(91, 110, 245, 0.25);
}
.btn-icon.delete {
  background: rgba(224, 85, 85, 0.15);
  color: var(--accent-danger);
}
.btn-icon.delete:hover {
  background: rgba(224, 85, 85, 0.25);
}

/* ============================================================
   SCHEDULE PAGE (Weekly Table)
   ============================================================ */
.week-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  background: var(--bg-card);
  padding: 6px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.week-tab {
  flex: 1;
  min-width: 70px;
  padding: 9px 8px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.week-tab:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}
.week-tab.active {
  background: var(--gradient-main);
  color: white;
}
.week-tab.today-tab {
  outline: 2px solid var(--accent-warn);
  outline-offset: -2px;
}

.day-schedule {
  animation: fadeIn 0.25s ease;
}
.day-schedule-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 14px;
}

.schedule-task-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  transition: all var(--transition);
}
.schedule-task-row.is-main {
  border-right: 3px solid var(--accent-primary);
}
.schedule-task-row:hover {
  border-color: var(--border-hover);
}

.day-add-task-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-hover);
  background: transparent;
  color: var(--accent-primary);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
}
.day-add-task-btn:hover {
  background: rgba(91, 110, 245, 0.08);
}

/* ============================================================
   MUTARAKIM (المتراكم) PAGE
   ============================================================ */
.mutarakim-empty {
  text-align: center;
  padding: 80px 20px;
}
.mutarakim-empty .big-icon {
  font-size: 72px;
  margin-bottom: 20px;
  display: block;
}
.mutarakim-empty h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.mutarakim-empty p {
  color: var(--text-secondary);
  font-size: 14px;
}

.mutarakim-item {
  background: var(--bg-card);
  border: 1px solid rgba(224, 85, 85, 0.25);
  border-right: 3px solid var(--accent-danger);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition);
}
.mutarakim-item:hover {
  box-shadow: 0 4px 16px rgba(224, 85, 85, 0.12);
}
.mutarakim-date {
  font-size: 11px;
  color: var(--accent-danger);
  font-weight: 600;
  background: rgba(224, 85, 85, 0.1);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.btn-complete-mutarakim {
  margin-right: auto;
  padding: 7px 14px;
  background: rgba(46, 204, 138, 0.1);
  border: 1px solid rgba(46, 204, 138, 0.3);
  color: var(--accent-success);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-complete-mutarakim:hover {
  background: rgba(46, 204, 138, 0.2);
}

/* ============================================================
   REPORT PAGE
   ============================================================ */
.report-month-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
}
.report-month-selector label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}
.month-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}
.month-select:focus {
  border-color: var(--accent-primary);
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.report-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}
.report-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}
.report-stat-value {
  font-size: 36px;
  font-weight: 900;
}
.report-stat-value.green {
  color: var(--accent-success);
}
.report-stat-value.blue {
  color: var(--accent-primary);
}
.report-stat-value.orange {
  color: var(--accent-warn);
}
.report-stat-value.red {
  color: var(--accent-danger);
}
.report-stat-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Subject Progress Bars in Report */
.subject-progress-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.subject-progress-item {
}
.subject-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.subject-progress-name {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.subject-progress-count {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.subject-bar-bg {
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  height: 8px;
  overflow: hidden;
}
.subject-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient-main);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Score badge in report */
.score-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.score-grade {
  font-size: 28px;
  font-weight: 900;
}
.score-label {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Performance Note History */
.note-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.note-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.note-item-date {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.note-item-task {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.note-item-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.note-type-badge {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}
.note-type-badge.hw {
  background: rgba(63, 184, 240, 0.15);
  color: var(--accent-info);
}
.note-type-badge.training {
  background: rgba(124, 92, 191, 0.15);
  color: #a67dd4;
}
.note-type-badge.note {
  background: rgba(245, 166, 35, 0.15);
  color: var(--accent-warn);
}

/* ============================================================
   FORMS & INPUTS
   ============================================================ */
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(91, 110, 245, 0.12);
}
.form-textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}
.form-select {
  cursor: pointer;
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── Radio Group ─────────────────────────── */
.radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.radio-option:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}
.radio-option.selected {
  background: rgba(91, 110, 245, 0.12);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.radio-option input {
  display: none;
}

/* ── Toggle Switch ───────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child {
  border-bottom: none;
}
.toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}
.toggle-switch {
  width: 44px;
  height: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-switch.on {
  background: var(--accent-success);
  border-color: var(--accent-success);
}
.toggle-switch::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 50%;
  right: 3px;
  transform: translateY(-50%);
  transition: right var(--transition);
}
.toggle-switch.on::after {
  right: calc(100% - 21px);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  padding: 11px 22px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary {
  background: var(--gradient-main);
  color: white;
}
.btn-primary:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}
.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover {
  border-color: var(--border-hover);
}
.btn-danger {
  background: rgba(224, 85, 85, 0.12);
  border: 1px solid rgba(224, 85, 85, 0.3);
  color: var(--accent-danger);
}
.btn-danger:hover {
  background: rgba(224, 85, 85, 0.2);
}
.btn-success {
  background: rgba(46, 204, 138, 0.12);
  border: 1px solid rgba(46, 204, 138, 0.3);
  color: var(--accent-success);
}
.btn-success:hover {
  background: rgba(46, 204, 138, 0.22);
}
.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
.modal-lg {
  max-width: 650px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover {
  background: rgba(224, 85, 85, 0.15);
  color: var(--accent-danger);
}
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  max-width: 380px;
  animation: toastIn 0.3s ease;
  pointer-events: all;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
}
.toast.success {
  border-color: rgba(46, 204, 138, 0.4);
  color: var(--accent-success);
}
.toast.error {
  border-color: rgba(224, 85, 85, 0.4);
  color: var(--accent-danger);
}
.toast.info {
  border-color: rgba(91, 110, 245, 0.4);
  color: var(--accent-primary);
}
.toast.warning {
  border-color: rgba(245, 166, 35, 0.4);
  color: var(--accent-warn);
}
.toast.out {
  animation: toastOut 0.3s ease forwards;
}

/* ============================================================
   CHIPS / TAGS
   ============================================================ */
.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.emoji-option {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.emoji-option:hover {
  border-color: var(--border-hover);
  transform: scale(1.12);
}
.emoji-option.selected {
  border-color: var(--accent-primary);
  background: rgba(91, 110, 245, 0.15);
}

/* ============================================================
   SETUP INTRO (First Launch)
   ============================================================ */
.setup-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
  animation: fadeIn 0.5s ease;
}
.setup-intro-icon {
  font-size: 80px;
  margin-bottom: 24px;
  animation: float 3s ease-in-out infinite;
}
.setup-intro h1 {
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 12px;
}
.setup-intro h1 span {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.setup-intro p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 460px;
  line-height: 1.7;
  margin-bottom: 32px;
}
.setup-steps {
  display: flex;
  gap: 16px;
  margin-bottom: 36px;
  flex-wrap: wrap;
  justify-content: center;
}
.setup-step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 150px;
  text-align: center;
}
.setup-step-card .step-num {
  width: 32px;
  height: 32px;
  background: var(--gradient-main);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  color: white;
  margin: 0 auto 10px;
}
.setup-step-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 4px;
}
.setup-step-card h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  #sidebar {
    transform: translateX(100%);
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
  }
  #main-content {
    margin-right: 0;
    padding: 20px 16px;
    padding-top: 70px;
  }
  #menu-toggle {
    display: flex;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .setup-grid {
    grid-template-columns: 1fr;
  }
  .report-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 500px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .week-tabs {
    gap: 4px;
  }
  .week-tab {
    font-size: 11px;
    padding: 8px 4px;
    min-width: 40px;
  }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}
@keyframes load {
  0% {
    width: 0;
  }
  100% {
    width: 100%;
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(16px);
  }
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--bg-card) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: var(--radius-md);
}
@keyframes skeleton-wave {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* Utility */
.hidden {
  display: none !important;
}
.flex {
  display: flex;
}
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.gap-2 {
  gap: 8px;
}
.gap-3 {
  gap: 12px;
}
.mt-2 {
  margin-top: 8px;
}
.mt-4 {
  margin-top: 16px;
}
.text-muted {
  color: var(--text-secondary);
}
.text-small {
  font-size: 12px;
}
.font-bold {
  font-weight: 700;
}
.w-full {
  width: 100%;
}
