/* ==========================================================================
   GymTracker PWA - Premium Dark Theme & Mobile-First Styling
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg-dark: #090d16;
  --bg-card: rgba(22, 31, 51, 0.75);
  --bg-card-solid: #131b2e;
  --bg-input: #1c273e;
  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-green: #00e676;
  --accent-orange: #ff9100;
  --accent-red: #ff5252;
  --text-main: #f0f4f8;
  --text-muted: #8e9bb0;
  --border-color: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(0, 242, 254, 0.15);
  --shadow-glow: 0 4px 25px rgba(0, 242, 254, 0.15);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-heading: 'Outfit', -apple-system, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(0, 242, 254, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(79, 172, 254, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  padding-bottom: 85px; /* space for fixed bottom nav */
  touch-action: manipulation;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: #2a3854;
  border-radius: 10px;
}

/* Header & Top Bar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--glass-border);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.3);
}

.brand-text {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 40%, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-status {
  font-size: 13px;
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(0, 242, 254, 0.2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-green);
}

/* Container & Sections */
.main-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

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

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

/* Navigation Bar (Bottom) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: rgba(15, 22, 36, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  max-width: 600px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  background: none;
  border: none;
  width: 25%;
  height: 100%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  transition: transform 0.2s ease;
}

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

.nav-item.active svg {
  transform: translateY(-2px);
  filter: drop-shadow(0 2px 8px rgba(0, 242, 254, 0.4));
}

/* Cards & Glass Containers */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease;
}

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

.card-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Badge Tags */
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-pierna { background: rgba(255, 82, 82, 0.15); color: #ff5252; border: 1px solid rgba(255, 82, 82, 0.3); }
.badge-pectoral { background: rgba(79, 172, 254, 0.15); color: #4facfe; border: 1px solid rgba(79, 172, 254, 0.3); }
.badge-espalda { background: rgba(0, 230, 118, 0.15); color: #00e676; border: 1px solid rgba(0, 230, 118, 0.3); }
.badge-hombro { background: rgba(255, 145, 0, 0.15); color: #ff9100; border: 1px solid rgba(255, 145, 0, 0.3); }
.badge-biceps { background: rgba(224, 64, 251, 0.15); color: #e040fb; border: 1px solid rgba(224, 64, 251, 0.3); }
.badge-triceps { background: rgba(0, 229, 255, 0.15); color: #00e5ff; border: 1px solid rgba(0, 229, 255, 0.3); }
.badge-abdomen { background: rgba(255, 235, 59, 0.15); color: #ffeb3b; border: 1px solid rgba(255, 235, 59, 0.3); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #050b14;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-success {
  background: linear-gradient(135deg, #00e676, #00b0ff);
  color: #050b14;
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:active {
  background: #253350;
}

.btn-danger {
  background: rgba(255, 82, 82, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(255, 82, 82, 0.3);
}

.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  width: auto;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
}

/* Quick Action Cards */
.workout-hero-card {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.08), rgba(22, 31, 51, 0.9));
  border: 1px solid var(--glass-border);
  padding: 24px 20px;
  text-align: center;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.workout-timer-display {
  font-family: var(--font-heading);
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1px;
  color: #fff;
  margin: 10px 0;
  text-shadow: 0 0 20px rgba(0, 242, 254, 0.4);
}

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

.exercise-live-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.exercise-live-card.completed {
  border-color: rgba(0, 230, 118, 0.4);
  background: rgba(0, 230, 118, 0.03);
}

.exercise-live-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 14px;
}

/* Set Table */
.set-row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr 50px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.set-row:last-child {
  border-bottom: none;
}

.set-number {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

.set-input-group {
  display: flex;
  flex-direction: column;
}

.set-input-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-transform: uppercase;
}

.set-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 8px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  width: 100%;
}

/* Stepper +/- controls for weight and reps */
.stepper-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.btn-step {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  width: 28px;
  height: 36px;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-step:active {
  background: var(--accent-cyan);
  color: #000;
  transform: scale(0.95);
}

.btn-step:disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Reorder item row in routine editor */
.reorder-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-bottom: 4px;
  font-size: 13px;
}

.btn-reorder {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 2px;
}

.btn-reorder:hover, .btn-reorder:active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Add / Remove Set buttons in Live Workout */
.set-controls-bar {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.btn-add-set {
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-add-set:active {
  background: var(--accent-cyan);
  color: #000;
}

.btn-remove-set {
  background: rgba(255, 82, 82, 0.1);
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.set-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.btn-check-set {
  width: 44px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-check-set.done {
  background: var(--accent-green);
  color: #000;
  border-color: var(--accent-green);
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.4);
}

/* Rest Timer Overlay (Floating at Bottom above nav) */
.rest-timer-banner {
  position: fixed;
  bottom: 75px;
  left: 12px;
  right: 12px;
  max-width: 576px;
  margin: 0 auto;
  background: rgba(19, 27, 46, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 8px 30px rgba(0, 242, 254, 0.25);
  z-index: 999;
  animation: slideUp 0.3s ease;
}

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

.rest-timer-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rest-timer-seconds {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-cyan);
}

.rest-timer-controls {
  display: flex;
  gap: 6px;
}

/* Routine Configurator */
.routine-day-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}

.exercise-select-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  margin: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.exercise-select-chip.selected {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--accent-cyan);
  color: #fff;
  font-weight: 600;
}

/* Filter Pills */
.filter-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 14px;
  white-space: nowrap;
}

.filter-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.filter-pill.active {
  background: var(--accent-blue);
  color: #000;
  border-color: var(--accent-blue);
}

/* Form Controls */
.form-group {
  margin-bottom: 14px;
}

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

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

/* History Card */
.history-item {
  border-left: 3px solid var(--accent-cyan);
  padding-left: 12px;
  margin-bottom: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-item:hover {
  border-left-color: var(--accent-green);
}

.history-detail-drawer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
  animation: fadeIn 0.2s ease;
}

.history-detail-exercise {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 6px;
}

.history-set-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card-solid);
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  margin-right: 4px;
  margin-top: 4px;
  color: var(--text-main);
}

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.flex-gap { display: flex; gap: 10px; }

/* Profile Selector Header Pill */
.profile-pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 4px 10px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-pill-btn:hover, .profile-pill-btn:active {
  border-color: var(--accent-cyan);
  background: #253350;
}

/* Modal Overlay & Card */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 8, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.profile-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-item-card.active {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.08);
}

/* Category Group Accordion in Routine Editor */
.category-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  margin-top: 8px;
  user-select: none;
}

.category-group-header:hover {
  border-color: var(--glass-border);
}

.category-group-body {
  padding: 8px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.category-group-body.collapsed {
  display: none;
}


