/* ═══════════════════════════════════════════════════════════════════
   Running Coach — Design System
   Premium dark-mode interface with glassmorphism and micro-animations
   ═══════════════════════════════════════════════════════════════════ */

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

/* ─── CSS Variables ─────────────────────────────────────────────── */
:root {
  /* Background */
  --bg-primary: #06060f;
  --bg-secondary: #0d0d1a;
  --bg-card: rgba(18, 18, 38, 0.7);
  --bg-card-hover: rgba(24, 24, 48, 0.85);
  --bg-input: rgba(12, 12, 28, 0.6);
  --bg-elevated: rgba(30, 30, 55, 0.5);

  /* Accent Colors */
  --accent-orange: #FF6B35;
  --accent-orange-glow: rgba(255, 107, 53, 0.25);
  --accent-teal: #4ECDC4;
  --accent-teal-glow: rgba(78, 205, 196, 0.2);
  --accent-purple: #A78BFA;
  --accent-purple-glow: rgba(167, 139, 250, 0.2);
  --accent-rose: #FB7185;
  --accent-green: #34D399;
  --accent-amber: #FBBF24;
  --accent-blue: #60A5FA;

  /* Text */
  --text-primary: #EEEEF2;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;
  --text-accent: var(--accent-teal);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(78, 205, 196, 0.3);

  /* Glassmorphism */
  --glass-blur: 20px;
  --glass-bg: rgba(15, 15, 30, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow-orange: 0 0 30px rgba(255, 107, 53, 0.15);
  --shadow-glow-teal: 0 0 30px rgba(78, 205, 196, 0.1);

  /* Layout */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Sizing */
  --sidebar-width: 260px;
  --header-height: 64px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Ambient background glow */
body::before {
  content: '';
  position: fixed;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-orange-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -200px;
  left: -100px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-teal-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Layout ────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ─── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition-base);
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand .brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-orange), #ff9a6c);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-glow-orange);
}

.sidebar-brand h1 {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.sidebar-brand .brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-orange-glow);
  color: var(--accent-orange);
  border-color: rgba(255, 107, 53, 0.15);
}

.nav-item .nav-icon {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
}

.nav-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 12px 8px;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
}

.strava-status, .ollama-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot.connected {
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
  animation: pulse-glow 2s infinite;
}

.status-dot.disconnected {
  background: var(--accent-rose);
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ─── Main Content ──────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.page-header {
  padding: 28px 36px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-header .header-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.page-body {
  padding: 28px 36px 60px;
}

/* ─── View Toggle ───────────────────────────────────────────────── */
.view {
  display: none;
  animation: fadeIn var(--transition-base) ease;
}

.view.active {
  display: block;
}

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

/* ─── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-base);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ─── Stat Cards Grid ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:nth-child(1)::before { background: linear-gradient(90deg, var(--accent-orange), var(--accent-amber)); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, var(--accent-teal), var(--accent-blue)); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, var(--accent-purple), var(--accent-rose)); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, var(--accent-green), var(--accent-teal)); }
.stat-card:nth-child(5)::before { background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple)); }
.stat-card:nth-child(6)::before { background: linear-gradient(90deg, var(--accent-rose), var(--accent-orange)); }

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-light);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-unit {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: 4px;
}

.stat-change {
  font-size: 0.75rem;
  margin-top: 6px;
  font-weight: 500;
}

.stat-change.positive { color: var(--accent-green); }
.stat-change.negative { color: var(--accent-rose); }
.stat-change.neutral { color: var(--text-muted); }

/* ─── Charts ────────────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-base);
}

.chart-container:hover {
  border-color: var(--border-light);
}

.chart-container.full-width {
  grid-column: 1 / -1;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-wrapper {
  position: relative;
  height: 280px;
}

/* ─── Table ─────────────────────────────────────────────────────── */
.runs-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  background: var(--bg-card);
}

.runs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.runs-table thead {
  background: rgba(255, 255, 255, 0.03);
}

.runs-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

.runs-table th:hover {
  color: var(--text-primary);
}

.runs-table th.sorted {
  color: var(--accent-teal);
}

.runs-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.83rem;
  white-space: nowrap;
}

.runs-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

.runs-table tr:last-child td {
  border-bottom: none;
}

.run-name {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  color: var(--text-primary) !important;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.run-source {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: 'Inter', sans-serif;
}

.run-source.strava { background: rgba(252, 82, 0, 0.15); color: #FC5200; }
.run-source.csv { background: rgba(78, 205, 196, 0.15); color: var(--accent-teal); }
.run-source.manual { background: rgba(167, 139, 250, 0.15); color: var(--accent-purple); }

.delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-size: 1rem;
}

.delete-btn:hover {
  color: var(--accent-rose);
  background: rgba(251, 113, 133, 0.1);
}

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-orange), #e85d2a);
  color: white;
  box-shadow: var(--shadow-glow-orange);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 0 40px rgba(255, 107, 53, 0.25);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
}

.btn-strava {
  background: linear-gradient(135deg, #FC5200, #E34902);
  color: white;
}

.btn-strava:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(252, 82, 0, 0.3);
}

.btn-danger {
  background: rgba(251, 113, 133, 0.1);
  color: var(--accent-rose);
  border: 1px solid rgba(251, 113, 133, 0.2);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(251, 113, 133, 0.2);
}

/* ─── Toggle Segmented Control ──────────────────────────────────── */
.toggle-group {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.toggle-group .toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-group .toggle-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.toggle-group .toggle-btn.active {
  color: var(--bg-primary);
  background: var(--accent-teal);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-icon {
  font-size: 1.1rem;
}

/* ─── Form Elements ─────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px var(--accent-teal-glow);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239CA3AF' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Drop Zone ─────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--bg-card);
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-teal);
  background: rgba(78, 205, 196, 0.05);
}

.drop-zone-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.drop-zone-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.drop-zone-hint {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ─── Settings Panel ────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 24px;
}

.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.settings-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── Notifications / Toast ─────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  animation: slideInRight var(--transition-base) ease, fadeOut var(--transition-base) ease 3.5s forwards;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}

.toast.success {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.3);
  color: var(--accent-green);
}

.toast.error {
  background: rgba(251, 113, 133, 0.15);
  border-color: rgba(251, 113, 133, 0.3);
  color: var(--accent-rose);
}

.toast.info {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.3);
  color: var(--accent-blue);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ─── Skeleton Loader ───────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.05) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Empty State ───────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 40px;
}

.empty-state-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

/* ─── Loading Spinner ───────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent-orange);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Pace Predictor ────────────────────────────────────────────── */
.predictor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.predictor-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  transition: all var(--transition-base);
}

.predictor-card:hover {
  border-color: var(--accent-teal);
  transform: translateY(-2px);
}

.predictor-distance {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.predictor-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-teal);
}

.predictor-pace {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Action Bar ────────────────────────────────────────────────── */
.action-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.action-bar-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ─── Badge ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.badge-orange {
  background: var(--accent-orange-glow);
  color: var(--accent-orange);
}

/* ─── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 520px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .page-body {
    padding: 20px 16px 60px;
  }
  
  .page-header {
    padding: 20px 16px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .settings-grid {
    grid-template-columns: 1fr;
  }
  
  .mobile-menu-btn {
    display: flex !important;
  }
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  margin-right: 12px;
}

/* ─── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ─── Run table filters ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar .form-input,
.filter-bar .form-select {
  width: auto;
  min-width: 160px;
}

.runs-count {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── Manual add run form inline ────────────────────────────────── */
.add-run-form {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  display: none;
}

.add-run-form.visible {
  display: block;
  animation: fadeIn var(--transition-base) ease;
}

/* ─── Unified Dashboard & AI Coach Layout ───────────────────────────── */

.dashboard-layout {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}

@media (max-width: 1100px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
}

.charts-grid-unified {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 1400px) {
  .charts-grid-unified {
    grid-template-columns: 1fr;
  }
}

.ollama-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ─── Coach Widgets ────────────────────────────────────────────────── */

.coach-dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 480px) {
  .coach-dashboard-row {
    grid-template-columns: 1fr;
  }
}

.card-title-section {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
}

.card-title-icon {
  font-size: 1.25rem;
}

.card-title-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Pace insights grid */
.pace-insights-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pace-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.pace-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Predictions grid */
.predictions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.prediction-tile {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.pred-distance {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.pred-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-teal);
}

/* Suggested schedule calendar */
.calendar-week-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.calendar-week-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.coach-week-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.coach-toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: calc(var(--radius-md) - 2px);
  transition: all var(--transition-fast);
}

.coach-toggle-btn.active {
  background: var(--accent-teal);
  color: #111827;
}

.week-focus-banner {
  background: var(--accent-teal-glow);
  border: 1px solid rgba(20, 184, 166, 0.15);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

@media (max-width: 900px) {
  .calendar-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 600px) {
  .calendar-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 400px) {
  .calendar-grid {
    grid-template-columns: 1fr;
  }
}

.calendar-day-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
  min-height: 120px;
}

.calendar-day-card:hover {
  border-color: var(--accent-teal);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.calendar-day-name {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.workout-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
  text-align: center;
  align-self: flex-start;
}

.workout-badge.rest { background: rgba(107, 114, 128, 0.15); color: #9CA3AF; }
.workout-badge.easy_run { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.workout-badge.tempo { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.workout-badge.intervals { background: rgba(239, 68, 68, 0.15); color: #F87171; }
.workout-badge.long_run { background: rgba(139, 92, 246, 0.15); color: #A78BFA; }
.workout-badge.recovery { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.workout-badge.test { background: rgba(236, 72, 153, 0.15); color: #F472B6; }

.calendar-day-metrics {
  margin-top: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.calendar-day-desc-preview {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* Workout details card for modal */
.workout-detail-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.workout-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.workout-detail-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
}

.workout-detail-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.workout-detail-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.workout-detail-desc {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Streaming and text boxes */
.coach-response-text {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.cursor-blink::after {
  content: '▋';
  animation: blink 1s step-end infinite;
  color: var(--accent-teal);
  margin-left: 2px;
}

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

.coach-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  background: var(--bg-card);
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-lg);
}

.coach-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.3;
}

.coach-empty-text {
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 280px;
  line-height: 1.5;
}

.coach-insights-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .coach-insights-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .coach-insights-row {
    grid-template-columns: 1fr;
  }
}

/* ─── Welcome Modal Specific ────────────────────────────────────── */
#welcome-modal-overlay {
  background: rgba(4, 4, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#welcome-modal {
  border: 1px solid rgba(78, 205, 196, 0.25);
  box-shadow: 0 0 40px rgba(78, 205, 196, 0.1);
  overflow-y: auto;
}

/* ─── Fitness Tests Styles ───────────────────────────────────────── */
.tests-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.test-card {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.test-card:hover {
  border-color: rgba(255, 107, 53, 0.2);
  box-shadow: var(--shadow-md);
}

.test-results {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed var(--border-subtle);
}

.results-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
}

@media (max-width: 768px) {
  .results-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.result-card-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.vdot-score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.vdot-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.vdot-value {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
  margin: 8px 0;
  font-family: 'JetBrains Mono', monospace;
}

.vdot-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.rating-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

/* Gauge Slider */
.gauge-container {
  padding: 10px 0 20px 0;
}

.gauge-bar {
  position: relative;
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: visible;
}

.gauge-fill {
  height: 100%;
  border-radius: var(--radius-full);
  opacity: 0.35;
}

.gauge-marker {
  position: absolute;
  top: -4px;
  width: 6px;
  height: 20px;
  border-radius: var(--radius-full);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  border: 2px solid #fff;
  transform: translateX(-50%);
  transition: left var(--transition-slow) ease-out;
}

.gauge-label-tick {
  position: absolute;
  top: 18px;
  font-size: 0.65rem;
  color: var(--text-muted);
  transform: translateX(-50%);
}

.matched-run-meta {
  font-size: 0.82rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

.meta-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.meta-value {
  color: var(--text-primary);
  line-height: 1.4;
}

/* Predictions Grid */
.predictions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
}

.prediction-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  transition: background var(--transition-fast);
}

.prediction-box:hover {
  background: rgba(255, 255, 255, 0.04);
}

.predict-dist {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.predict-time {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-orange);
  font-family: 'JetBrains Mono', monospace;
}

.result-section-title {
  font-size: 0.88rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-primary);
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  border-left: 3px solid var(--accent-orange);
  padding-left: 8px;
}

/* Training Paces Table */
.zones-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.88rem;
}

.zones-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
}

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

.zones-table tr:last-child td {
  border-bottom: none;
}

.zones-table td:nth-child(2), .zones-table td:nth-child(3) {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}

.zone-color-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
}
