/* ============================================================
   LockIn - Performance Dark Design System
   ============================================================ */

:root {
  --bg-main: #0a0f1d;
  --bg-card: #131c2e;
  --bg-card-hover: #18233a;
  --bg-elevated: #1e293b;
  --bg-glass: rgba(19, 28, 46, 0.75);
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-active: rgba(16, 185, 129, 0.4);
  
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-glow: rgba(16, 185, 129, 0.25);
  
  --accent-lime: #84cc16;
  --accent-amber: #f59e0b;
  --accent-cyan: #06b6d4;
  --accent-rose: #f43f5e;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 25px var(--primary-glow);
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 90px; /* Space for mobile bottom bar */
  overflow-x: hidden;
}

/* Background Atmosphere */
body::before {
  content: '';
  position: fixed;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 650px;
  height: 450px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, rgba(6, 182, 212, 0.05) 50%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

/* Typography */
h1, h2, h3, h4, .brand-title {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  font-weight: 700;
}

/* Header & Navigation */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 20px;
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), #047857);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 0 15px var(--primary-glow);
}

.brand-text {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

/* Desktop Nav Links */
.desktop-nav {
  display: none;
  align-items: center;
  gap: 8px;
}

@media (min-width: 768px) {
  .desktop-nav {
    display: flex;
  }
  body {
    padding-bottom: 40px;
  }
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-link:hover {
  color: var(--text-main);
  background: var(--bg-card);
}

.nav-link.active {
  color: var(--primary);
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--border-active);
}

/* Mobile Bottom Navigation */
.mobile-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(13, 20, 34, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
  .mobile-nav-bar {
    display: none;
  }
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color 0.2s ease;
}

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.2;
}

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

.mobile-nav-item.active svg {
  filter: drop-shadow(0 0 6px var(--primary-glow));
}

/* Main Container */
.main-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 10;
}

/* Tabs Management */
.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-pane.active {
  display: block;
}

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

/* Cards & Surface */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.glass-card.highlight {
  border-color: rgba(16, 185, 129, 0.25);
  background: linear-gradient(145deg, #131d30, #16243c);
}

/* Grid Layouts */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

.stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-unit {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-subtext {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.badge-cyan {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
}

/* Action Banner */
.action-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(6, 182, 212, 0.08));
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 640px) {
  .action-banner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.banner-content h2 {
  font-size: 1.45rem;
  margin-bottom: 4px;
}

.banner-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.banner-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--primary);
  color: #06241a;
  font-weight: 700;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  background: #22c55e;
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.35);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: #27354a;
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-outline:hover {
  background: var(--bg-card);
  border-color: var(--text-muted);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 15px 28px;
  font-size: 1.1rem;
  border-radius: var(--radius-md);
}

.btn-icon {
  padding: 10px;
  border-radius: var(--radius-md);
}

/* Circuit Exercises Preview Card */
.routine-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.routine-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.routine-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.routine-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.routine-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
}

.routine-target {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.routine-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent-cyan);
}

/* Chart Container & Range Pills */
.chart-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

@media (min-width: 640px) {
  .chart-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.range-pills {
  display: inline-flex;
  background: var(--bg-elevated);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.range-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
}

.range-btn.active {
  background: var(--primary);
  color: #06241a;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 320px;
}

/* History List / Table */
.history-section {
  margin-top: 24px;
}

.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.2s;
}

.history-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.history-date {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.history-notes {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.history-weight {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

/* Active Workout HUD Modal */
.workout-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 8, 15, 0.96);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  display: none;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px;
}

.workout-modal-overlay.active {
  display: flex;
}

.workout-hud-container {
  max-width: 600px;
  margin: auto;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hud-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}

.hud-round-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
}

.hud-timer-badge {
  background: var(--bg-elevated);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-family: monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Exercise Step in HUD */
.hud-exercise-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hud-exercise-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hud-step-num {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-cyan);
  text-transform: uppercase;
}

.hud-exercise-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.hud-exercise-target {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Stepper Controls */
.stepper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 16px;
}

.stepper-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.stepper-btn:active {
  background: var(--primary);
  color: #000;
}

.stepper-val {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
}

/* Stopwatch for Bear Hug Carry */
.stopwatch-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: rgba(6, 182, 212, 0.05);
  border: 1px dashed rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-md);
}

.stopwatch-ring-wrapper {
  position: relative;
  width: 130px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stopwatch-ring-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.stopwatch-circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 8;
}

.stopwatch-circle-fg {
  fill: none;
  stroke: var(--accent-cyan);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear;
}

.stopwatch-text {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  z-index: 2;
}

.stopwatch-controls {
  display: flex;
  gap: 10px;
}

/* Generic Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 1rem;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

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

.st-lbs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

@media (min-width: 768px) {
  .toast-container {
    bottom: 30px;
  }
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.25s ease-out forwards;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.4);
  background: #112224;
}

.toast.error {
  border-color: rgba(244, 63, 94, 0.4);
  background: #2a1219;
}

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

/* Single Password Lock Screen */
.lockscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lockscreen-card {
  max-width: 400px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

/* Ad-hoc Activity Styles */
.activity-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.preset-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.preset-chip.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.quick-pills {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.quick-pill-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.quick-pill-btn:hover {
  color: var(--text-main);
  border-color: var(--border-active);
}

.activity-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
}

