/* === BRUNO FIT — Dark Fitness Theme === */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a28;
  --bg-card-hover: #22223a;
  --text-primary: #f0f0f5;
  --text-secondary: #8888aa;
  --text-muted: #55557a;
  --accent: #ff6b35;
  --accent-glow: rgba(255, 107, 53, 0.3);
  --accent-green: #00e676;
  --accent-blue: #448aff;
  --accent-purple: #b388ff;
  --border: #2a2a3e;
  --danger: #ff1744;
  --warning: #ffd740;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  padding-bottom: 80px;
  -webkit-tap-highlight-color: transparent;
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

/* === NAVIGATION === */
#nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  padding-top: 4px;
}
.nav-brand {
  display: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}
.nav-links {
  display: flex;
  justify-content: space-around;
  padding: 4px 0 8px;
}
.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.2s;
  border-radius: var(--radius-sm);
}
.nav-link.active {
  color: var(--accent);
}
.nav-link svg { opacity: 0.7; }
.nav-link.active svg { opacity: 1; }

/* === MAIN === */
#app {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

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

/* === HEADERS === */
.page-header {
  margin-bottom: 20px;
  padding-top: 8px;
}
.page-header h1 {
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}
.date-badge {
  display: inline-block;
  background: var(--bg-card);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* === CARDS === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.card-header .badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 700;
}

/* === EXERCISE ROW === */
.exercise-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  gap: 8px;
}
.exercise-row:last-child { border-bottom: none; }
.exercise-info { flex: 1; }
.exercise-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}
.exercise-meta {
  font-size: 12px;
  color: var(--text-secondary);
}
.exercise-sets {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.set-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.set-dot.completed {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: #000;
}
.set-dot:hover { border-color: var(--accent); }

/* === BUTTONS === */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); }
.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  border-radius: 8px;
}
.btn-sm:hover { background: var(--border); color: var(--text-primary); }
.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-card-hover);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === TIMER OVERLAY === */
#timer-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: opacity 0.3s;
}
#timer-overlay.hidden { display: none; }
.timer-container {
  text-align: center;
}
.timer-ring {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 24px;
}
.timer-svg { transform: rotate(-90deg); width: 200px; height: 200px; }
.timer-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}
.timer-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}
.timer-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
#timer-display {
  font-size: 48px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}
#timer-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 4px;
}
.timer-controls {
  display: flex;
  gap: 16px;
  justify-content: center;
}

/* === WEEKLY ROUTINE === */
.day-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}
.day-card:hover { border-color: var(--accent-glow); }
.day-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
}
.day-name {
  font-size: 15px;
  font-weight: 700;
}
.day-focus {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.day-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg-card-hover);
  color: var(--text-muted);
}
.day-card.today {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}
.day-card.today .day-badge {
  background: var(--accent);
  color: #000;
}
.day-card.exercises { padding: 0 16px 14px; }
.day-card.exercises .exercise-row { padding: 8px 0; }
.day-card.exercises .exercise-name { font-size: 13px; }

/* === NUTRITION === */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.macro-item {
  text-align: center;
  padding: 12px;
  background: var(--bg-card-hover);
  border-radius: var(--radius-sm);
}
.macro-value {
  font-size: 22px;
  font-weight: 900;
}
.macro-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}
.macro-target {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.macro-progress {
  height: 4px;
  background: var(--bg-primary);
  border-radius: 4px;
  margin-top: 6px;
  overflow: hidden;
}
.macro-progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.meal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
}
.meal-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}
.meal-name { font-weight: 700; font-size: 14px; }
.meal-cal { color: var(--accent); font-weight: 700; }
.meal-macros { font-size: 12px; color: var(--text-secondary); }

/* === METRICS === */
#metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.metric-icon { font-size: 28px; margin-bottom: 4px; }
.metric-value {
  font-size: 28px;
  font-weight: 900;
}
.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}
.metric-input {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.metric-input input {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  text-align: center;
}

/* === ENCYCLOPEDIA === */
.kb-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
}
.kb-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--accent);
}
.kb-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.kb-tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-glow);
  color: var(--accent);
  margin-right: 4px;
  margin-top: 6px;
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
.modal-overlay.hidden { display: none; }
.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 90%;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-content h2 { margin-bottom: 16px; font-size: 18px; }
.modal-content label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  margin-top: 12px;
}
.modal-content input, .modal-content select {
  width: 100%;
  padding: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

/* === RESPONSIVE === */
@media (min-width: 768px) {
  #app { max-width: 700px; padding: 24px; }
  .page-header h1 { font-size: 34px; }
  #nav { position: static; background: transparent; border: none; }
  .nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    padding: 0 0 16px;
    font-size: 20px;
  }
  .nav-brand span { -webkit-text-fill-color: var(--accent); }
  .nav-links { gap: 4px; }
  .nav-link { font-size: 11px; }
  #metrics-grid { grid-template-columns: repeat(3, 1fr); }
}

/* === UTILITIES === */
.hidden { display: none !important; }
.text-accent { color: var(--accent); }
.text-green { color: var(--accent-green); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
