/* ============================================================
   STUDENT MENTAL HEALTH EARLY WARNING SYSTEM — STYLES
   Design: Clinical-Modern with Dynamic Mood Theming
   ============================================================ */

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

/* ── CSS Variables / Themes ─────────────────────────────── */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1c2128;
  --bg-card-hover: #21262d;
  --border: rgba(255,255,255,0.08);
  --border-accent: rgba(255,255,255,0.15);
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --accent: #58a6ff;
  --accent-glow: rgba(88,166,255,0.2);
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.3);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;

  /* Mood gradient overlays */
  --mood-gradient: radial-gradient(ellipse at 20% 50%, rgba(88,166,255,0.06) 0%, transparent 60%),
                   radial-gradient(ellipse at 80% 20%, rgba(63,185,80,0.04) 0%, transparent 50%);
}

/* Mood Themes */
body.mood-1 {
  --mood-gradient: radial-gradient(ellipse at 20% 50%, rgba(248,81,73,0.18) 0%, transparent 60%),
                   radial-gradient(ellipse at 80% 20%, rgba(180,30,30,0.12) 0%, transparent 50%);
  --accent: #f85149;
  --accent-glow: rgba(248,81,73,0.2);
  --bg-primary: #110808;
  --bg-secondary: #1a0e0e;
  --bg-card: #1f1212;
}

body.mood-2 {
  --mood-gradient: radial-gradient(ellipse at 20% 50%, rgba(230,155,70,0.18) 0%, transparent 60%),
                   radial-gradient(ellipse at 80% 20%, rgba(210,153,34,0.12) 0%, transparent 50%);
  --accent: #e69946;
  --accent-glow: rgba(230,155,70,0.2);
  --bg-primary: #100d06;
  --bg-secondary: #1a1508;
  --bg-card: #1f1a0d;
}

body.mood-3 {
  --mood-gradient: radial-gradient(ellipse at 20% 50%, rgba(88,166,255,0.10) 0%, transparent 60%),
                   radial-gradient(ellipse at 80% 20%, rgba(100,100,180,0.08) 0%, transparent 50%);
  --accent: #79c0ff;
  --accent-glow: rgba(121,192,255,0.2);
}

body.mood-4 {
  --mood-gradient: radial-gradient(ellipse at 20% 50%, rgba(63,185,80,0.14) 0%, transparent 60%),
                   radial-gradient(ellipse at 80% 20%, rgba(40,160,80,0.10) 0%, transparent 50%);
  --accent: #56d364;
  --accent-glow: rgba(86,211,100,0.2);
  --bg-primary: #070f09;
  --bg-secondary: #0d160f;
  --bg-card: #111c13;
}

body.mood-5 {
  --mood-gradient: radial-gradient(ellipse at 20% 50%, rgba(63,210,80,0.22) 0%, transparent 60%),
                   radial-gradient(ellipse at 80% 20%, rgba(80,220,130,0.15) 0%, transparent 50%);
  --accent: #3dd68c;
  --accent-glow: rgba(61,214,140,0.25);
  --bg-primary: #050f09;
  --bg-secondary: #09160d;
  --bg-card: #0e1d12;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: var(--bg-primary);
  background-image: var(--mood-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  transition: background-color 0.8s ease, background-image 0.8s ease;
  -webkit-font-smoothing: antialiased;
}

/* Animated noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--text-primary); }

/* ── Layout ─────────────────────────────────────────────── */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 80px;
}

/* ── Header / Nav ────────────────────────────────────────── */
.site-header {
  width: 100%;
  max-width: 780px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 40px;
  position: relative;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent-glow));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 16px var(--accent-glow);
  transition: var(--transition);
}

.logo:hover .logo-icon { transform: rotate(10deg) scale(1.05); }

.nav-links {
  display: flex;
  gap: 6px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  transition: var(--transition);
  border: 1px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-card);
  border-color: var(--border-accent);
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
  opacity: 0;
  transition: var(--transition);
}

.card:hover { border-color: var(--border-accent); background: var(--bg-card-hover); box-shadow: var(--shadow-sm); }
.card:hover::before { opacity: 1; }

/* ── Hero Section ────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 60px 0 50px;
  animation: fadeInUp 0.6s ease both;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(88,166,255,0.1);
  border: 1px solid rgba(88,166,255,0.2);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 24px;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, white));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s ease;
}

.btn:hover::after { background: rgba(255,255,255,0.06); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #0d1117;
  box-shadow: 0 0 24px var(--accent-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 30px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-accent);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 0 20px rgba(248,81,73,0.3);
}
.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 30px rgba(248,81,73,0.4);
}

.btn-lg { padding: 16px 40px; font-size: 1.05rem; border-radius: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Feature Cards (index) ───────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 40px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px;
  transition: var(--transition);
  cursor: default;
}

.feature-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.3);
}

.feature-icon {
  font-size: 1.8rem;
  margin-bottom: 12px;
  display: block;
}

.feature-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.feature-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Form Styles ─────────────────────────────────────────── */
.form-wrapper {
  width: 100%;
  max-width: 600px;
  animation: fadeInUp 0.5s ease both;
}

.form-header {
  margin-bottom: 32px;
}

.form-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.form-header p { color: var(--text-secondary); font-size: 0.9rem; }

.form-group {
  margin-bottom: 24px;
}

label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

label .label-hint {
  text-transform: none;
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0;
  margin-left: 6px;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-accent);
  color: var(--text-primary);
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
  appearance: none;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-card);
}

input[type="number"]::placeholder { color: var(--text-muted); }

/* Mood Slider */
.mood-slider-wrapper {
  position: relative;
}

.mood-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.mood-value-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
  transition: var(--transition);
}

.mood-emoji { font-size: 1.4rem; }

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-secondary);
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-glow);
  transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 18px var(--accent-glow);
}

.mood-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Status Badge ────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-normal { background: rgba(63,185,80,0.15); color: #3fb950; border: 1px solid rgba(63,185,80,0.3); }
.status-warning { background: rgba(210,153,34,0.15); color: #d29922; border: 1px solid rgba(210,153,34,0.3); }
.status-critical { background: rgba(248,81,73,0.15); color: #f85149; border: 1px solid rgba(248,81,73,0.3); }

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Dashboard ───────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 var(--radius) var(--radius);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.metric-card:hover { border-color: var(--border-accent); }
.metric-card:hover::after { transform: scaleX(1); }

.metric-icon {
  font-size: 1.5rem;
  margin-bottom: 10px;
  display: block;
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.metric-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font);
}

.metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
}

.trend-up { color: #3fb950; }
.trend-down { color: #f85149; }
.trend-stable { color: #8b949e; }

/* Status Banner */
.status-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  transition: var(--transition);
  animation: slideIn 0.5s ease both;
}

.status-banner.critical {
  border-color: rgba(248,81,73,0.4);
  background: rgba(248,81,73,0.05);
}

.status-banner.warning {
  border-color: rgba(210,153,34,0.4);
  background: rgba(210,153,34,0.05);
}

.status-banner.normal {
  border-color: rgba(63,185,80,0.4);
  background: rgba(63,185,80,0.05);
}

.status-info h3 { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.status-info p { font-size: 0.83rem; color: var(--text-secondary); }

/* Insight Cards */
.insights-section { margin-bottom: 24px; }

.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.insight-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  font-size: 0.87rem;
  transition: var(--transition);
  animation: fadeInLeft 0.4s ease both;
}

.insight-item:hover { border-color: var(--border-accent); }

.insight-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.insight-text { color: var(--text-secondary); line-height: 1.5; }
.insight-text strong { color: var(--text-primary); }

/* History Table */
.history-section { margin-bottom: 24px; }

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.history-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

.history-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  transition: var(--transition);
}

.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: var(--bg-card-hover); color: var(--text-primary); }

.mood-pip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Alert Page ─────────────────────────────────────────── */
.alert-page body,
body.alert-mode {
  --accent: #f85149;
  --accent-glow: rgba(248,81,73,0.3);
}

.alert-hero {
  text-align: center;
  padding: 40px 0 30px;
  animation: fadeInUp 0.5s ease both;
}

.alert-icon-wrapper {
  width: 80px;
  height: 80px;
  background: rgba(248,81,73,0.15);
  border: 2px solid rgba(248,81,73,0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto 24px;
  animation: pulse-alert 2s ease-in-out infinite;
}

@keyframes pulse-alert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248,81,73,0.4); }
  50% { box-shadow: 0 0 0 16px rgba(248,81,73,0); }
}

.alert-hero h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #f85149;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.alert-hero p { color: var(--text-secondary); max-width: 440px; margin: 0 auto; }

/* Reasons list */
.reasons-card {
  background: rgba(248,81,73,0.06);
  border: 1px solid rgba(248,81,73,0.25);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.reasons-card h3 {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f85149;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 16px;
}

.reason-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(248,81,73,0.12);
  font-size: 0.88rem;
  animation: fadeInLeft 0.3s ease both;
}

.reason-item:last-child { border-bottom: none; }

.reason-bullet {
  width: 22px; height: 22px;
  background: rgba(248,81,73,0.15);
  border: 1px solid rgba(248,81,73,0.3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  color: #f85149;
  font-weight: 700;
}

.reason-text { color: var(--text-secondary); line-height: 1.5; }
.reason-text strong { color: var(--text-primary); }

/* Steps */
.steps-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.steps-card h3 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 16px;
}

.step-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
  animation: fadeInLeft 0.4s ease both;
}

.step-item:last-child { border-bottom: none; }

.step-num {
  width: 26px; height: 26px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-accent);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
  flex-shrink: 0;
}

.step-content h4 { font-size: 0.88rem; font-weight: 600; margin-bottom: 3px; }
.step-content p { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.85rem; }

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 28px 0;
}

/* ── Toasts ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  color: var(--text-primary);
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  z-index: 1000;
  animation: slideUpIn 0.3s ease both;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { border-color: rgba(63,185,80,0.4); }
.toast.error { border-color: rgba(248,81,73,0.4); }

@keyframes slideUpIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Loading ──────────────────────────────────────────────── */
.loading-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  z-index: 9999;
  animation: loadBar 0.6s ease forwards;
}

@keyframes loadBar {
  from { width: 0; }
  to { width: 100%; }
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.anim-delay-1 { animation-delay: 0.1s; }
.anim-delay-2 { animation-delay: 0.2s; }
.anim-delay-3 { animation-delay: 0.3s; }
.anim-delay-4 { animation-delay: 0.4s; }
.anim-delay-5 { animation-delay: 0.5s; }

/* Stagger children */
.stagger > * { opacity: 0; animation: fadeInUp 0.5s ease forwards; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.12s; }
.stagger > *:nth-child(3) { animation-delay: 0.19s; }
.stagger > *:nth-child(4) { animation-delay: 0.26s; }
.stagger > *:nth-child(5) { animation-delay: 0.33s; }
.stagger > *:nth-child(6) { animation-delay: 0.40s; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .features-grid, .dashboard-grid { grid-template-columns: 1fr; gap: 10px; }
  .resources-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.8rem; }
  .nav-links { gap: 4px; }
  .nav-links a { padding: 5px 10px; font-size: 0.8rem; }
  .status-banner { flex-direction: column; gap: 14px; align-items: flex-start; }
  .site-header { padding: 16px 0 28px; }
  .score-breakdown { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid .metric-card:last-child { grid-column: span 2; }
}

/* ── Productivity Score Card ─────────────────────────────── */
.score-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  transition: var(--transition);
}

.score-card:hover { border-color: var(--border-accent); }

.score-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}

.score-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.score-main {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.score-number {
  font-size: 3rem;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1;
  transition: color 0.5s ease;
}

.score-pct-label {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.score-grade {
  font-size: 0.9rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 20px;
  background: var(--bg-secondary);
  transition: color 0.5s ease;
  margin-bottom: 6px;
}

/* Score Progress Bar */
.score-bar-track {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.score-bar-fill {
  height: 100%;
  border-radius: 4px;
  width: 0%;
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1), background 0.5s ease;
}

/* Score Breakdown */
.score-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.score-segment {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: center;
  transition: var(--transition);
}

.score-segment:hover { border-color: var(--border-accent); }

.score-seg-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.score-seg-val {
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* ── Alert Timeline (alerts.html) ───────────────────────── */
.alert-timeline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  margin-bottom: 8px;
  gap: 14px;
  transition: var(--transition);
  animation: fadeInLeft 0.4s ease both;
  flex-wrap: wrap;
}

.alert-timeline-item:hover { border-color: var(--border-accent); background: var(--bg-card-hover); }

.alert-tl-left { flex: 1; min-width: 140px; }
.alert-tl-date { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.alert-tl-flags { display: flex; gap: 5px; flex-wrap: wrap; }

.alert-tl-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.alert-flag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.alert-flag.danger  { background: rgba(248,81,73,0.15);  color: #f85149; border: 1px solid rgba(248,81,73,0.3); }
.alert-flag.warning { background: rgba(210,153,34,0.15); color: #d29922; border: 1px solid rgba(210,153,34,0.3); }
.alert-flag.info    { background: rgba(88,166,255,0.15); color: #79c0ff; border: 1px solid rgba(88,166,255,0.3); }
.alert-flag.ok      { background: rgba(63,185,80,0.12);  color: #3fb950; border: 1px solid rgba(63,185,80,0.25); }

/* ── Resource Cards (resources.html) ────────────────────── */
.resource-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.resource-filter-btn {
  padding: 7px 16px;
  border-radius: 20px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-accent);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: var(--transition);
}

.resource-filter-btn:hover,
.resource-filter-btn.active {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.resource-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.resource-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s ease;
}

.resource-card:hover { border-color: var(--border-accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.resource-card:hover::before { transform: scaleY(1); }

.resource-icon { font-size: 1.8rem; }
.resource-category {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
}

.resource-card h3 { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.resource-card p  { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.55; flex: 1; }

.resource-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  padding: 6px 0;
  transition: var(--transition);
  margin-top: auto;
}

.resource-link:hover { gap: 8px; }

/* Tip Box */
.tip-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.tip-box h3 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tip-list { list-style: none; }
.tip-list li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  line-height: 1.5;
}
.tip-list li:last-child { border-bottom: none; }
.tip-list li::before { content: attr(data-icon); flex-shrink: 0; }

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

/* ── Utility ─────────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.mt-32 { margin-top: 32px; }
.mb-12 { margin-bottom: 12px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-10 { gap: 10px; }
.gap-14 { gap: 14px; }
.w-full { width: 100%; }
.mono { font-family: var(--font-mono); }
