/**
 * ShredFit Design System — Apple-Inspired Minimal
 * Clean, understated, premium. Think Apple Health meets Fitness+.
 */

/* ========== RESET ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
}

/* ========== CSS CUSTOM PROPERTIES ========== */
:root {
  --bg: #0d0f14;
  --bg-card: #1c1f2a;
  --bg-elevated: #252836;
  --bg-hover: #2f3344;
  --bg-surface: #1c1f2a;

  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.08);

  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-subtle: rgba(255, 255, 255, 0.04);

  --text: #f5f5f7;
  --text-secondary: #8e9aaf;
  --text-tertiary: #5e6272;
  --text-muted: #3a3d47;

  --accent: #0a84ff;
  --accent-dark: #0071e3;
  --accent-glow: rgba(10, 132, 255, 0.12);

  --type-easy: #30d158;
  --type-easy-glow: rgba(48, 209, 88, 0.10);
  --type-moderate: #0a84ff;
  --type-moderate-glow: rgba(10, 132, 255, 0.10);
  --type-hard: #ff9f0a;
  --type-hard-glow: rgba(255, 159, 10, 0.10);
  --type-recovery: #bf5af2;
  --type-recovery-glow: rgba(191, 90, 242, 0.10);
  --type-race: #ff375f;
  --type-race-glow: rgba(255, 55, 95, 0.10);

  --green: #30d158;
  --green-glow: rgba(48, 209, 88, 0.10);
  --blue: #0a84ff;
  --blue-glow: rgba(10, 132, 255, 0.10);
  --purple: #bf5af2;
  --purple-glow: rgba(191, 90, 242, 0.10);
  --orange: #ff9f0a;
  --orange-glow: rgba(255, 159, 10, 0.10);
  --red: #ff453a;
  --yellow: #ffd60a;

  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', system-ui, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ========== BASE BODY ========== */
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: calc(80px + var(--safe-bottom));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

/* ========== BOTTOM NAV — iOS Tab Bar ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(13, 15, 20, 0.95);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid rgba(255, 255, 255, 0.08);
  padding: 6px 0 calc(6px + var(--safe-bottom));
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  z-index: 100;
  min-height: 49px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  padding: 4px 12px;
  transition: color 0.15s ease;
  position: relative;
  min-width: 44px;
  min-height: 44px;
}

.nav-item.active {
  color: var(--text);
}

.nav-item.active::before {
  display: none;
}

.nav-item.active svg {
  fill: none;
  fill-opacity: 0;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.5;
  transition: transform 0.15s ease;
}

.nav-item:active svg {
  transform: scale(0.9);
}

/* Hero Plan button */
.nav-item-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
  position: relative;
  min-width: 56px;
  margin-top: -24px;
  z-index: 2;
}

.nav-item-hero .hero-circle {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(10, 132, 255, 0.3);
  border: 2.5px solid var(--bg);
  transition: transform 0.15s ease;
}

.nav-item-hero .hero-circle svg {
  width: 22px;
  height: 22px;
  stroke: #fff;
}

.nav-item-hero .hero-ring { display: none; }

.nav-item-hero:active .hero-circle {
  transform: scale(0.92);
}

.nav-item-hero.active .hero-circle {
  background: var(--accent);
}

.nav-item-hero.active {
  color: var(--text);
}

/* ========== TOAST ========== */
.toast-container {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
}

.toast {
  background: var(--bg-elevated);
  border: 0.5px solid var(--glass-border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.25s ease-out;
  white-space: nowrap;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.toast.success { border-color: rgba(48, 209, 88, 0.2); }
.toast.error { border-color: rgba(255, 69, 58, 0.2); }

/* ========== ANIMATIONS ========== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes checkPop { 0% { transform: scale(0.6); opacity: 0; } 50% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }

.coach-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  display: none;
  border: 2px solid var(--bg);
}
.coach-badge.show { display: block; }
