/* styles.css — Clean, modern light fitness look */

/* ===== CSS Variables ===== */
:root {
  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  /* Neutrals */
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e8edf3;
  --text: #0f172a;
  --text-soft: #64748b;
  --text-muted: #94a3b8;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Radii */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);

  /* Tap target */
  --tap-size: 48px;

  /* Transitions */
  --transition: 150ms ease;
}

/* ===== Theme: Clean (default) ===== */
body.theme-clean,
body:not([class*="theme-"]) {
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --btn-bg: #2563eb;
}

/* ===== Theme: Violet ===== */
body.theme-violet {
  --accent: #7c3aed;
  --accent-soft: #f5f3ff;
  --btn-bg: linear-gradient(135deg, #8b5cf6, #6366f1);
}

/* ===== Theme: Sunset ===== */
body.theme-sunset {
  --accent: #e11d48;
  --accent-soft: #fff1f2;
  --btn-bg: linear-gradient(135deg, #fb7185, #f59e0b);
}

/* ===== Theme: Mint ===== */
body.theme-mint {
  --accent: #0d9488;
  --accent-soft: #f0fdfa;
  --btn-bg: linear-gradient(135deg, #14b8a6, #22c55e);
}

/* ===== Reset ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ===== App Shell ===== */
#app {
  height: 100%;
  padding-bottom: calc(var(--tap-size) + var(--space-md) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen {
  display: none;
  min-height: 100%;
  padding: var(--space-lg) var(--space-md);
}
.screen.active {
  display: block;
}

/* ===== Section Headings ===== */
.list-section h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  margin-top: var(--space-lg);
}
.list-section h2:first-child {
  margin-top: 0;
}

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.card:active {
  transform: scale(0.985);
}

/* Empty state card (soft dashed) */
.empty {
  background: var(--bg);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  color: var(--text-muted);
  font-style: normal;
  font-size: 0.9rem;
  margin-bottom: var(--space-sm);
}

/* ===== Buttons ===== */
button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition);
  user-select: none;
}

.btn-primary {
  background: var(--btn-bg);
  color: #ffffff;
  padding: 13px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: var(--shadow-md);
}
.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-weight: 500;
  font-size: 0.9rem;
}
.btn-secondary:hover {
  background: var(--bg);
}
.btn-secondary:active {
  transform: scale(0.98);
}

.btn-small {
  background: var(--surface);
  color: var(--text-soft);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
}
.btn-small:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.btn-small.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.btn-small:active {
  transform: scale(0.97);
}

.btn-danger {
  color: #ef4444;
  border-color: #fecaca;
}
.btn-danger:hover {
  background: #fef2f2;
}

.btn-icon {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-soft);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.full-width {
  width: 100%;
}

/* ===== Inputs & Forms ===== */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="search"],
select {
  font-family: var(--font);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="checkbox"] {
  width: auto;
  margin-right: var(--space-sm);
  accent-color: var(--accent);
}

/* ===== Location Chips (pills) ===== */
.quick-pick {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-md) 0;
  flex-wrap: wrap;
}
.chip-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-soft);
  margin-right: var(--space-xs);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  transition: all var(--transition);
  gap: var(--space-xs);
}
.chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}
.chip:active {
  transform: scale(0.96);
}

/* ===== Bottom Tab Bar ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--space-xs) var(--space-sm) calc(var(--space-xs) + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -1px 6px rgba(0,0,0,0.03);
  z-index: 100;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 6px 14px;
  min-width: 60px;
  min-height: var(--tap-size);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  gap: 3px;
}
.tab:hover {
  color: var(--text-soft);
}
.tab.active {
  color: var(--accent);
}
.tab:active {
  transform: scale(0.95);
}

.tab-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tab-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-label {
  line-height: 1;
}

/* ===== Screen Reader Only ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ===== Typography ===== */
h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ===== Active Workout Overlay ===== */
body.workout-active .tab-bar {
  display: none;
}
.overlay {
  background: var(--bg);
}

/* ===== Helpers ===== */
.list-section {
  margin-top: 0;
}