/* ─── StudyCoach — Dark Brutalist Theme ─── */
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&family=Bebas+Neue&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --bg:       #080810;
  --bg2:      #0f0f1e;
  --bg3:      #16162a;
  --border:   #1e1e3a;
  --accent:   #e94560;
  --accent2:  #0f3460;
  --text:     #e8e8f0;
  --muted:    #6b6b8a;
  --success:  #00c853;
  --warning:  #ff9800;
  --danger:   #f44336;
  --mono:     'Space Mono', monospace;
  --sans:     'Inter', sans-serif;
  --display:  'Bebas Neue', cursive;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Layout ─── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo {
  font-family: var(--display);
  font-size: 28px;
  color: var(--accent);
  letter-spacing: 2px;
  line-height: 1;
}
.sidebar-brand .tagline {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 4px;
  font-family: var(--mono);
}

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.nav-item:hover { color: var(--text); background: var(--bg3); }
.nav-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(233,69,96,0.08); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
}
.user-name { font-size: 13px; font-weight: 500; }
.user-email { font-size: 11px; color: var(--muted); }

.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 32px;
  max-width: calc(100vw - 240px);
}

/* ─── Cards ─── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 1.5px;
  color: var(--text);
}

/* ─── Page header ─── */
.page-header { margin-bottom: 28px; }
.page-title { font-family: var(--display); font-size: 40px; letter-spacing: 2px; line-height: 1; }
.page-subtitle { color: var(--muted); font-size: 13px; margin-top: 6px; font-family: var(--mono); }

/* ─── Stats grid ─── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
}
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.blue::before { background: #4fc3f7; }
.stat-value { font-family: var(--display); font-size: 38px; color: var(--text); line-height: 1; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; margin-top: 4px; font-family: var(--mono); }
.stat-change { font-size: 12px; margin-top: 8px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ─── Progress bar ─── */
.progress-wrap { margin: 12px 0; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-family: var(--mono); }
.progress-track { background: var(--bg3); border-radius: 50px; height: 8px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; border-radius: 50px; transition: width 0.5s cubic-bezier(0.4,0,0.2,1); background: var(--accent); }
.progress-fill.success { background: var(--success); }

/* ─── Forms ─── */
.form-group { margin-bottom: 18px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; font-family: var(--mono); }
input, select, textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type=range] { padding: 6px 0; background: transparent; }
select option { background: var(--bg2); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s;
  font-family: var(--sans);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #c73652; transform: translateY(-1px); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ─── Alerts ─── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; border-left: 3px solid; }
.alert-success { background: rgba(0,200,83,0.1); border-color: var(--success); color: #80e8b0; }
.alert-error   { background: rgba(244,67,54,0.1); border-color: var(--danger);  color: #f99; }
.alert-warning { background: rgba(255,152,0,0.1);  border-color: var(--warning); color: #ffc87a; }
.alert-info    { background: rgba(79,195,247,0.1); border-color: #4fc3f7; color: #90d8f7; }

/* ─── Tables ─── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 16px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--border); font-family: var(--mono); }
td { padding: 12px 16px; border-bottom: 1px solid rgba(30,30,58,0.5); color: var(--text); }
tr:hover td { background: var(--bg3); }

/* ─── Streak badge ─── */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ff6b00, #e94560);
  color: #fff;
  padding: 6px 14px;
  border-radius: 50px;
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 1px;
}

/* ─── Weekly chart bars ─── */
.chart-bar-wrap { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding: 10px 0; }
.chart-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.chart-bar { width: 100%; border-radius: 4px 4px 0 0; min-height: 4px; transition: height 0.4s; }
.chart-day { font-size: 10px; color: var(--muted); font-family: var(--mono); }

/* ─── Auth pages ─── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% 50%, rgba(233,69,96,0.08) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 20%, rgba(15,52,96,0.2) 0%, transparent 50%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
}
.auth-logo { font-family: var(--display); font-size: 40px; color: var(--accent); letter-spacing: 3px; text-align: center; margin-bottom: 4px; }
.auth-tagline { text-align: center; color: var(--muted); font-size: 12px; font-family: var(--mono); letter-spacing: 2px; margin-bottom: 32px; }
.auth-divider { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 13px; color: var(--muted); }
.auth-switch a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ─── Log session quick widget ─── */
.log-widget {
  background: linear-gradient(135deg, var(--bg2), var(--bg3));
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 28px;
}
.log-widget h3 { font-family: var(--display); font-size: 24px; letter-spacing: 1.5px; margin-bottom: 12px; }

/* ─── Tone selector ─── */
.tone-options { display: flex; gap: 8px; flex-wrap: wrap; }
.tone-btn {
  padding: 8px 16px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}
.tone-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tone-btn:hover { border-color: var(--accent); color: var(--text); }

/* ─── Tabs ─── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
  text-decoration: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar { width: 100%; height: 56px; flex-direction: row; position: fixed; bottom: 0; top: auto; border-right: none; border-top: 1px solid var(--border); }
  .sidebar-brand, .sidebar-footer { display: none; }
  .sidebar-nav { display: flex; flex-direction: row; padding: 0; overflow-x: auto; }
  .nav-item { flex-direction: column; gap: 3px; padding: 8px 16px; font-size: 10px; border-left: none; border-top: 3px solid transparent; }
  .nav-item.active { border-left: none; border-top-color: var(--accent); }
  .main-content { margin-left: 0; margin-bottom: 56px; padding: 16px; max-width: 100vw; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Misc ─── */
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
a { color: var(--accent); }
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-mono { font-family: var(--mono); }
.mt-0 { margin-top: 0 !important; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }
