/* ── Variables — Dark (default) ─────────────────────────────────────────────── */
:root {
  --bg:       #0f1117;
  --bg2:      #1a1f2e;
  --bg3:      #242b3d;
  --accent:   #f97316;
  --accent2:  #fb923c;
  --text:     #f1f5f9;
  --muted:    #8892a4;
  --border:   #2a3245;
  --success:  #22c55e;
  --danger:   #ef4444;
  --radius:   12px;
  --radius-lg: 18px;
  --shadow:   0 4px 24px rgba(0,0,0,0.35);
}

/* ── Light theme ─────────────────────────────────────────────────────────────── */
body.light {
  --bg:      #f4f6fb;
  --bg2:     #ffffff;
  --bg3:     #e8edf5;
  --text:    #1e293b;
  --muted:   #64748b;
  --border:  #cbd5e1;
  --shadow:  0 4px 20px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background .25s, color .25s;
}

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

/* ── Header ──────────────────────────────────────────────────────────────────── */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 1.4rem;
  color: var(--accent);
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
}

/* ── Tab Navigation ──────────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, color .2s;
  display: flex;
  align-items: center;
  gap: 7px;
}

.tab-btn i { font-size: .85rem; }
.tab-btn:hover { background: var(--bg3); color: var(--text); }
.tab-btn.active { background: var(--accent); color: #fff; }

.theme-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .2s;
}
.theme-btn:hover { background: var(--border); }

/* ── Mode Toggle (Gym / Home) ────────────────────────────────────────────────── */
.mode-toggle {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px;
  width: fit-content;
}

.mode-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .2s, color .2s;
}

.mode-btn i { font-size: .9rem; }
.mode-btn.active { background: var(--accent); color: #fff; }
.mode-btn:not(.active):hover { background: var(--bg3); color: var(--text); }

/* ── Main / Tabs ─────────────────────────────────────────────────────────────── */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Section Header ──────────────────────────────────────────────────────────── */
.section-header { margin-bottom: 28px; }
.section-header h2 { font-size: 1.75rem; font-weight: 800; margin-bottom: 6px; }
.section-header p { color: var(--muted); font-size: .95rem; }

/* ── Loading ─────────────────────────────────────────────────────────────────── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 20px;
  color: var(--muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

/* ── Error / Placeholder ─────────────────────────────────────────────────────── */
.error-msg {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.error-msg i { font-size: 1rem; flex-shrink: 0; }

.placeholder-msg {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
}

.placeholder-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
  opacity: .4;
}

.placeholder-img {
  width: 280px;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  opacity: .7;
}

/* ── Workout Header ──────────────────────────────────────────────────────────── */
.workout-header {
  background: linear-gradient(135deg, var(--accent) 0%, #c2410c 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 32px;
}

.workout-day {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: .85;
  margin-bottom: 6px;
}

.workout-title { font-size: 2rem; font-weight: 900; margin-bottom: 8px; }
.workout-desc { opacity: .9; font-size: .95rem; margin-bottom: 20px; }

.progress-bar-bg {
  background: rgba(255,255,255,.25);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  background: #fff;
  border-radius: 999px;
  transition: width .4s ease;
}

.progress-text { font-size: .85rem; font-weight: 600; opacity: .9; }

/* ── Home badge ──────────────────────────────────────────────────────────────── */
.home-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.2);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 999px;
  margin-top: 12px;
}

/* ── Exercise Grid ───────────────────────────────────────────────────────────── */
.exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* ── Exercise Card ───────────────────────────────────────────────────────────── */
.exercise-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s, opacity .3s;
  box-shadow: var(--shadow);
}

.exercise-card:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(0,0,0,.4); }
.exercise-card.done { opacity: .55; border-color: var(--success); }

.exercise-gif-wrap {
  background: var(--bg3);
  aspect-ratio: 4/3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.difficulty-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: capitalize;
  letter-spacing: .03em;
}
.difficulty-beginner  { background: rgba(34,197,94,.85);  color: #fff; }
.difficulty-intermediate { background: rgba(249,115,22,.85); color: #fff; }
.difficulty-expert    { background: rgba(239,68,68,.85);  color: #fff; }

.exercise-desc {
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.exercise-gif { width: 100%; height: 100%; object-fit: cover; }

.no-gif-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.no-gif-placeholder i { font-size: 3rem; opacity: .4; }
.no-gif-placeholder span { font-size: .8rem; }

.exercise-info { padding: 18px 20px 20px; }

.exercise-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
  text-transform: capitalize;
  line-height: 1.3;
}

.exercise-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag {
  font-size: .73rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: capitalize;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tag.target { background: rgba(249,115,22,.15); color: var(--accent); }
.tag.equipment { background: var(--bg3); color: var(--muted); }
.tag.secondary { background: rgba(34,197,94,.1); color: #4ade80; }

.sets-reps {
  font-size: .85rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(249,115,22,.08);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.instructions { margin-bottom: 14px; }

.instructions summary {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.instructions ol {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.instructions li { font-size: .82rem; color: var(--muted); line-height: 1.5; }

.btn-done {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 700;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .2s, color .2s, border-color .2s;
}

.btn-done:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.exercise-card.done .btn-done { background: var(--success); color: #fff; border-color: var(--success); }

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-actions .btn-done { flex: 1; }

.btn-youtube {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ff0000;
  color: #fff;
  font-family: inherit;
  font-size: .8rem;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 8px;
  transition: background .2s;
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}

.btn-youtube:hover { background: #cc0000; text-decoration: none; }
.btn-youtube i { font-size: .95rem; }

.btn-youtube-lg {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #ff0000;
  color: #fff;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 700;
  padding: 14px 24px;
  border-radius: 10px;
  margin-top: 24px;
  transition: background .2s;
}
.btn-youtube-lg:hover { background: #cc0000; text-decoration: none; }

/* ── Rest Day ────────────────────────────────────────────────────────────────── */
.rest-day {
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
  padding-bottom: 40px;
}

.rest-photo-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 28px;
  height: 260px;
}

.rest-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rest-photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, rgba(0,0,0,.2) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 28px;
  color: #fff;
}

.rest-photo-icon { font-size: 2.5rem; margin-bottom: 10px; }
.rest-photo-overlay h2 { font-size: 2rem; font-weight: 900; }

.rest-day h2 { font-size: 2rem; font-weight: 800; margin-bottom: 12px; }
.rest-day p { color: var(--muted); margin-bottom: 28px; font-size: 1rem; }

.rest-tips {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  background: var(--bg2);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  border: 1px solid var(--border);
}

.rest-tips li {
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.rest-tips li i { color: var(--accent); width: 18px; text-align: center; flex-shrink: 0; }

/* ── Search Bar ──────────────────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.search-bar input,
.search-bar select {
  flex: 1;
  min-width: 180px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  padding: 12px 16px;
  border-radius: 10px;
  outline: none;
  transition: border-color .2s;
}

.search-bar input:focus,
.search-bar select:focus { border-color: var(--accent); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-primary:hover { background: var(--accent2); }

.btn-secondary {
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-secondary:hover { background: var(--bg3); }

/* ── Weekly Grid ─────────────────────────────────────────────────────────────── */
.weekly-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.day-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  transition: transform .2s, box-shadow .2s;
  position: relative;
}

.day-card:not(.rest-card) { cursor: pointer; }
.day-card:not(.rest-card):hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.day-card.today { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(249,115,22,.3); }
.day-card.rest-card { opacity: .6; }

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

.today-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.day-focus { font-size: 1.05rem; font-weight: 800; margin-bottom: 6px; }
.day-desc { font-size: .82rem; color: var(--muted); margin-bottom: 14px; line-height: 1.4; }

.day-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.day-options {
  display: flex;
  gap: 8px;
}

.day-opt-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: .75rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .2s, color .2s;
}

.day-opt-btn:hover,
.day-opt-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.rest-icon-sm i { font-size: 1.3rem; color: var(--muted); }

.section-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 20px; }

/* ── Gym Actions ─────────────────────────────────────────────────────────────── */
.gym-actions { display: flex; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }

.results-count { font-size: .9rem; color: var(--muted); margin-bottom: 16px; font-weight: 600; }

/* ── Gym Cards ───────────────────────────────────────────────────────────────── */
.gym-list { display: flex; flex-direction: column; gap: 14px; }

.gym-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: transform .2s;
}

.gym-card:hover { transform: translateY(-2px); }

.gym-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.gym-name { font-size: 1.05rem; font-weight: 700; margin-bottom: 5px; }

.gym-address {
  font-size: .85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.gym-address i { color: var(--accent); font-size: .8rem; }

.gym-distance {
  background: rgba(249,115,22,.12);
  color: var(--accent);
  font-size: .8rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.gym-details { display: flex; flex-direction: column; gap: 6px; }

.gym-detail {
  font-size: .85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.gym-detail i { color: var(--accent); width: 14px; text-align: center; flex-shrink: 0; }

.btn-maps {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  background: var(--accent);
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 8px;
  transition: background .2s;
}
.btn-maps:hover { background: var(--accent2); text-decoration: none; }

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 24px 20px;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  color: var(--muted);
}

/* ── Hamburger ───────────────────────────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all .25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner {
    flex-wrap: nowrap;
    height: 60px;
    padding: 0 16px;
    gap: 10px;
    justify-content: space-between;
  }

  .hamburger { display: flex; margin-left: auto; }
  .theme-btn { font-size: .72rem; padding: 6px 10px; flex-shrink: 0; }

  .tab-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    width: 100%;
    flex-direction: column;
    background: var(--bg2);
    border-bottom: 2px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    z-index: 200;
    padding: 10px 12px;
    gap: 4px;
  }
  .tab-nav.open { display: flex; }

  .tab-btn {
    width: 100%;
    text-align: left;
    padding: 13px 16px;
    font-size: 1rem;
    border-radius: 10px;
    justify-content: flex-start;
  }

  .workout-header { padding: 22px 20px; }
  .workout-title { font-size: 1.5rem; }
  .exercise-grid { grid-template-columns: 1fr; }
  .weekly-grid { grid-template-columns: 1fr 1fr; }
  .mode-toggle { width: 100%; }
  .mode-btn { flex: 1; justify-content: center; }
  .search-bar { flex-direction: column; }
  .search-bar input, .search-bar select { width: 100%; }
}

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