/* ============================================================
   FitLink Pro - Dark Theme CSS
   Inspired by Hevy App + Figma Design
   ============================================================ */

/* --- CSS Variables --- */
:root {
  --bg-primary:    #0A0A0C;
  --bg-secondary:  #141416;
  --bg-card:       #1E1E22;
  --bg-card2:      #242429;
  --bg-input:      #2A2A32;
  --bg-hover:      #2E2E36;

  --color-primary:      #FF6B35;
  --color-primary-dark: #CC4E1F;
  --color-primary-glow: rgba(255, 107, 53, 0.2);
  --color-secondary:    #FFD700;
  --color-success:      #4ECB71;
  --color-danger:       #FF4757;
  --color-warning:      #FFA502;
  --color-info:         #3D9EFF;

  --text-primary:   #FFFFFF;
  --text-secondary: #9A9AAA;
  --text-muted:     #5A5A6E;
  --text-inverse:   #000000;

  --border-color:  #2A2A35;
  --border-active: #FF6B35;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --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: 0 0 20px rgba(255, 107, 53, 0.3);

  --nav-height: 64px;
  --header-height: 60px;
  --transition: 0.2s ease;
}

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

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Selection */
::selection { background: var(--color-primary-glow); color: var(--color-primary); }

/* ============================================================
   LAYOUT
   ============================================================ */

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Auth screens */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.auth-screen::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -200px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255,107,53,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.auth-box {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.4s ease;
}

/* Main App Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(10, 10, 12, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
}

.header-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Page Content */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + 16px);
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--nav-height);
  background: rgba(20, 20, 22, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 8px 4px;
  transition: color var(--transition);
  position: relative;
  cursor: pointer;
}

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

.nav-item .nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform var(--transition);
}

.nav-item.active .nav-icon {
  transform: scale(1.1);
}

.nav-item .nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* Workout FAB */
.nav-item.nav-workout {
  flex: 1.4;
}

.nav-workout-btn {
  width: 52px;
  height: 52px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: var(--shadow-glow);
  transition: transform var(--transition), box-shadow var(--transition);
  margin-bottom: 2px;
}

.nav-item.nav-workout:active .nav-workout-btn {
  transform: scale(0.93);
  box-shadow: none;
}

/* ============================================================
   SCREENS / PAGES
   ============================================================ */

.screen {
  display: none;
  animation: fadeIn 0.25s ease;
}

.screen.active {
  display: block;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ============================================================
   COMPONENTS
   ============================================================ */

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-color);
  transition: border-color var(--transition);
}

.card:hover { border-color: var(--bg-hover); }

.card-sm { padding: 12px; }
.card-lg { padding: 24px; }

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-icon {
  font-size: 24px;
  line-height: 1;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card.highlight {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.stat-card.highlight .stat-value,
.stat-card.highlight .stat-label { color: #fff; }

/* Streak Card */
.streak-card {
  background: linear-gradient(135deg, var(--color-primary) 0%, #FF8C42 100%);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  box-shadow: var(--shadow-glow);
}

.streak-info .streak-count {
  font-size: 48px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.streak-info .streak-label {
  font-size: 14px;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
  margin-top: 4px;
}

.streak-emoji { font-size: 60px; }

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-link {
  font-size: 13px;
  color: var(--color-primary);
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
}

/* Workout List Item */
.workout-item {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.workout-item:hover, .workout-item:active {
  border-color: var(--color-primary);
  background: var(--bg-card2);
}

.workout-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.workout-item-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.workout-item-date {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.workout-item-meta {
  display: flex;
  gap: 16px;
}

.workout-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.workout-meta-item span:first-child { font-size: 14px; }

/* Exercise Item in Library */
.exercise-item {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color var(--transition);
}

.exercise-item:hover { border-color: var(--color-primary); }

.exercise-muscle-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.exercise-info { flex: 1; min-width: 0; }

.exercise-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exercise-tags {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  color: var(--text-secondary);
}

.tag.primary { background: var(--color-primary-glow); color: var(--color-primary); }
.tag.success { background: rgba(78,203,113,0.15); color: var(--color-success); }

/* Active Workout Screen */
.active-workout-header {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workout-timer {
  font-size: 28px;
  font-weight: 800;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}

.workout-exercise-block {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
  overflow: hidden;
}

.exercise-block-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border-color);
}

.exercise-block-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-primary);
}

.exercise-block-muscle {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Sets Table */
.sets-table {
  width: 100%;
  padding: 12px 16px;
}

.sets-header {
  display: grid;
  grid-template-columns: 32px 1fr 1fr 1fr 36px;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
}

.sets-header-cell {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.set-row {
  display: grid;
  grid-template-columns: 32px 1fr 1fr 1fr 36px;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.set-row.completed {
  background: rgba(78, 203, 113, 0.08);
}

.set-row.completed .set-number { color: var(--color-success); }

.set-number {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

.set-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 7px 4px;
  width: 100%;
  transition: border-color var(--transition);
  -moz-appearance: textfield;
}

.set-input::-webkit-outer-spin-button,
.set-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.set-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--bg-card2);
}

.set-check-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
  color: var(--text-muted);
  margin: 0 auto;
}

.set-check-btn.checked {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}

.set-row.is-pr .set-number::after {
  content: ' 🏆';
  font-size: 10px;
}

/* ============================================================
   FORMS & INPUTS
   ============================================================ */

.form-group {
  margin-bottom: 16px;
}

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

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  padding: 12px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.form-input::placeholder { color: var(--text-muted); }

.form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  padding: 12px 14px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239A9AAA' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  padding: 12px 14px;
  resize: vertical;
  min-height: 80px;
  transition: border-color var(--transition);
}

.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Search Bar */
.search-bar {
  position: relative;
  margin-bottom: 16px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 15px;
  padding: 11px 16px 11px 44px;
  transition: border-color var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Filter Pills */
.filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar { display: none; }

.filter-pill {
  flex-shrink: 0;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-pill:hover,
.filter-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}
.btn-primary:hover { background: var(--color-primary-dark); }

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

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}
.btn-ghost:hover { background: var(--color-primary-glow); }

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-success {
  background: var(--color-success);
  color: #fff;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 18px;
}

.btn-icon:hover { color: var(--text-primary); border-color: var(--text-muted); }

.btn-full { width: 100%; }

.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: var(--radius-sm); }

/* ============================================================
   PROGRESS / CHARTS
   ============================================================ */

.chart-container {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Calendar Heatmap */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--bg-input);
}

.cal-day.worked { background: var(--color-primary); }
.cal-day.today { box-shadow: 0 0 0 2px var(--color-primary); }

/* PRs List */
.pr-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.pr-item:last-child { border-bottom: none; }

.pr-exercise-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.pr-muscle { font-size: 12px; color: var(--text-secondary); }

.pr-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-secondary);
}

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-sheet {
  width: 100%;
  max-height: 92vh;
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.modal-overlay.open .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  flex-shrink: 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

/* ============================================================
   PROFILE
   ============================================================ */

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
  text-align: center;
}

.avatar-circle {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary) 0%, #FF8C42 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  box-shadow: var(--shadow-glow);
}

.profile-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-email {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.profile-stats-row {
  display: flex;
  gap: 2px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.profile-stat-item {
  flex: 1;
  text-align: center;
  padding: 16px 8px;
}

.profile-stat-item + .profile-stat-item {
  border-left: 1px solid var(--border-color);
}

.profile-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}

.profile-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Settings Menu */
.settings-menu {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-bottom: 16px;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border-color);
}

.settings-item:last-child { border-bottom: none; }

.settings-item:hover, .settings-item:active {
  background: var(--bg-hover);
}

.settings-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--bg-input);
  flex-shrink: 0;
}

.settings-text { flex: 1; }
.settings-label { font-size: 15px; font-weight: 500; color: var(--text-primary); }
.settings-desc  { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.settings-arrow { color: var(--text-muted); font-size: 18px; }

/* Body Weight Chart */
.bw-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}
.bw-entry:last-child { border-bottom: none; }
.bw-date { font-size: 13px; color: var(--text-secondary); }
.bw-value { font-size: 16px; font-weight: 700; color: var(--text-primary); }

/* ============================================================
   EMPTY STATES
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.5; }

.empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-desc {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 260px;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ============================================================
   LOADING / SPINNERS
   ============================================================ */

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

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,12,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}

.toast {
  background: var(--bg-card2);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
}

.toast.success { border-color: var(--color-success); }
.toast.error   { border-color: var(--color-danger); }
.toast.warning { border-color: var(--color-warning); }

/* Auth Styles */
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo .logo-big {
  width: 64px;
  height: 64px;
  background: var(--color-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-glow);
}

.auth-logo h1 {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #ccc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-logo p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* Routine Card */
.routine-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color var(--transition);
}

.routine-card:hover { border-color: var(--color-primary); }

.routine-card-header {
  padding: 14px 16px;
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.routine-name { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.routine-meta { font-size: 12px; color: var(--text-secondary); }

.routine-exercises-preview {
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.routine-ex-preview {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Misc Utilities */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: 16px 0;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary-color { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-muted   { color: var(--text-muted); }
.text-secondary-color { color: var(--text-secondary); }
.text-sm  { font-size: 13px; }
.text-xs  { font-size: 11px; }
.text-lg  { font-size: 18px; }
.text-xl  { font-size: 22px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ============================================================
   ANIMATIONS
   ============================================================ */

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

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

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

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

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

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

.pulse { animation: pulse 1.5s ease-in-out infinite; }

/* ============================================================
   RESPONSIVE - TABLET / DESKTOP
   ============================================================ */

@media (min-width: 768px) {
  .page-content {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 24px calc(var(--nav-height) + 24px);
  }

  .auth-box { padding: 48px 40px; }

  .stats-grid { grid-template-columns: repeat(4, 1fr); }

  .modal-overlay {
    align-items: center;
    padding: 20px;
  }

  .modal-sheet {
    border-radius: var(--radius-xl);
    max-width: 500px;
    margin: 0 auto;
    max-height: 85vh;
  }
}

@media (min-width: 1024px) {
  :root { --nav-height: 70px; }

  body { font-size: 15px; }

  .app-header { padding: 0 24px; }

  .bottom-nav {
    max-width: 640px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
  }
}

/* PWA Install Banner */
.pwa-banner {
  position: fixed;
  bottom: calc(var(--nav-height) + 12px);
  left: 16px;
  right: 16px;
  background: var(--bg-card2);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 500;
  box-shadow: var(--shadow-md);
  animation: fadeInUp 0.4s ease;
}

.pwa-banner-text { flex: 1; }
.pwa-banner-title { font-size: 14px; font-weight: 600; }
.pwa-banner-desc  { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.pwa-banner-close { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; padding: 4px; }

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 50%, var(--bg-input) 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; }
}
