/* ==========================================================================
   BANK FITNESS - Modern Glassmorphic Dark Theme & Mobile-First CSS System
   Color Palette: Deep Space Dark (#080c14), Cyan (#00E5FF), Neon Green (#00FF87)
   ========================================================================== */

:root {
  /* Colors */
  --bg-dark: #080c14;
  --bg-card: rgba(15, 23, 42, 0.65);
  --bg-card-hover: rgba(22, 33, 58, 0.75);
  --bg-input: rgba(10, 16, 28, 0.8);
  --bg-modal: rgba(8, 12, 20, 0.85);

  --accent-cyan: #00E5FF;
  --accent-cyan-glow: rgba(0, 229, 255, 0.35);
  --accent-neon: #00FF87;
  --accent-neon-glow: rgba(0, 255, 135, 0.35);
  --accent-orange: #FF7B00;
  --accent-red: #FF3B30;
  --accent-purple: #9D4EDD;

  --gradient-primary: linear-gradient(135deg, #00E5FF 0%, #00FF87 100%);
  --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 100%);
  --gradient-glow: linear-gradient(135deg, rgba(0,229,255,0.15) 0%, rgba(0,255,135,0.15) 100%);

  --text-main: #F8FAFC;
  --text-sub: #94A3B8;
  --text-muted: #64748B;

  --border-light: rgba(255, 255, 255, 0.08);
  --border-cyan: rgba(0, 229, 255, 0.25);
  --border-neon: rgba(0, 255, 135, 0.25);

  /* Fonts */
  --font-main: 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Shadows & Glass */
  --glass-border: 1px solid rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --neon-cyan-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
  --neon-green-shadow: 0 0 15px rgba(0, 255, 135, 0.4);

  /* Spacing & Layout */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --nav-height: 70px;
}

/* Reset & Core Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  user-select: none;
}

/* Subtle Animated Background Mesh */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(circle at 20% 30%, rgba(0, 229, 255, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(0, 255, 135, 0.07) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.5) 0%, transparent 60%);
  z-index: -1;
  pointer-events: none;
  animation: meshFloat 25s ease-in-out infinite alternate;
}

@keyframes meshFloat {
  0% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(-2%, 2%) rotate(2deg); }
  100% { transform: translate(2%, -2%) rotate(-2deg); }
}

/* Main Container - Mobile First with Desktop Centering */
#app-container {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: calc(var(--nav-height) + 20px);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.6);
  background: rgba(8, 12, 20, 0.95);
}

/* ==========================================================================
   Header & Top Navigation
   ========================================================================== */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.brand-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #080c14;
  box-shadow: var(--neon-cyan-shadow);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sync-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid var(--border-cyan);
  color: var(--accent-cyan);
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sync-btn:hover, .sync-btn:active {
  background: rgba(0, 229, 255, 0.2);
  transform: translateY(-1deg);
  box-shadow: var(--neon-cyan-shadow);
}

.sync-dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent-neon);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-neon);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

/* ==========================================================================
   SPA Page Views & Transitions
   ========================================================================== */
.view-page {
  display: none;
  padding: 20px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.view-page.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Section Header */
.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.section-title i {
  color: var(--accent-cyan);
}

/* Glass Card Component */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--glass-shadow);
  transition: all 0.3s ease;
}

.glass-card.neon-border-cyan {
  border: 1px solid var(--border-cyan);
}

.glass-card.neon-border-green {
  border: 1px solid var(--border-neon);
}

/* ==========================================================================
   Tab 1: Dashboard & Muscle Checklist
   ========================================================================== */
.hero-banner {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.12) 0%, rgba(0, 255, 135, 0.05) 100%);
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 100px;
  height: 100px;
  background: var(--gradient-primary);
  opacity: 0.15;
  filter: blur(25px);
  border-radius: 50%;
}

.hero-subtitle {
  font-size: 0.8rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.hero-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 4px 0 10px 0;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 15px;
}

.stat-box {
  background: rgba(8, 12, 20, 0.6);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.05);
  text-align: center;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent-neon);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-sub);
}

/* Muscle Checklist Grid */
.checklist-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.muscle-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.muscle-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-cyan);
}

.muscle-card.completed {
  background: linear-gradient(145deg, rgba(0, 255, 135, 0.12) 0%, rgba(15, 23, 42, 0.7) 100%);
  border: 1px solid var(--accent-neon);
  box-shadow: var(--neon-green-shadow);
}

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

.muscle-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(0, 229, 255, 0.1);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
}

.muscle-card.completed .muscle-icon {
  background: rgba(0, 255, 135, 0.2);
  color: var(--accent-neon);
}

.check-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.muscle-card.completed .check-badge {
  background: var(--accent-neon);
  border-color: var(--accent-neon);
  color: #080c14;
}

.muscle-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.muscle-desc {
  font-size: 0.72rem;
  color: var(--text-sub);
}

.muscle-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.muscle-progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  width: 0%;
  transition: width 0.4s ease;
}

.muscle-card.completed .muscle-progress-fill {
  background: var(--accent-neon);
}

/* Recent Activity List */
.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

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

.activity-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
}

.activity-info p {
  font-size: 0.75rem;
  color: var(--text-sub);
}

.activity-badge {
  background: rgba(0, 229, 255, 0.12);
  color: var(--accent-cyan);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ==========================================================================
   Tab 2: Workout Tracker
   ========================================================================== */
.guide-trigger-btn {
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid var(--border-cyan);
  color: var(--accent-cyan);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.guide-trigger-btn:hover {
  background: rgba(0, 229, 255, 0.25);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.finish-session-btn {
  background: rgba(0, 255, 135, 0.15);
  border: 1px solid var(--accent-neon);
  color: var(--accent-neon);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
}

.finish-session-btn:hover {
  background: var(--accent-neon);
  color: #080c14;
  box-shadow: var(--neon-green-shadow);
}

/* Category Horizontal Selector */
.category-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.category-scroll::-webkit-scrollbar {
  display: none;
}

.cat-chip {
  flex: 0 0 auto;
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-light);
  border-radius: 30px;
  color: var(--text-sub);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cat-chip.active {
  background: var(--gradient-primary);
  color: #080c14;
  border-color: transparent;
  box-shadow: var(--neon-cyan-shadow);
}

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

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

.select-input, .text-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.3s ease;
}

.select-input:focus, .text-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.grid-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.primary-btn {
  width: 100%;
  padding: 14px;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-md);
  color: #080c14;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--neon-cyan-shadow);
  transition: all 0.3s ease;
  margin-top: 8px;
}

.primary-btn:hover, .primary-btn:active {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 255, 135, 0.5);
}

/* Logging Table / List */
.logged-sets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(8, 12, 20, 0.7);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-cyan);
}

.set-num {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--accent-cyan);
}

.set-details {
  font-size: 0.88rem;
  font-weight: 600;
}

.delete-set-btn {
  background: transparent;
  border: none;
  color: var(--accent-red);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.delete-set-btn:hover {
  opacity: 1;
}

/* Quick Rest Timer Bar */
.rest-timer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid var(--border-cyan);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-top: 16px;
}

.timer-preset-btns {
  display: flex;
  gap: 6px;
}

.timer-btn {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-light);
  color: var(--accent-cyan);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.timer-btn:hover {
  background: var(--accent-cyan);
  color: #080c14;
}

/* ==========================================================================
   Tab 3: Workout History
   ========================================================================== */
.history-date-header {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent-cyan);
  margin: 14px 0 6px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ==========================================================================
   Tab 4: Stats & Tools
   ========================================================================== */
.tools-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 220px;
  margin-top: 10px;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.calc-result-box {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.1) 0%, rgba(0, 255, 135, 0.1) 100%);
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  margin-top: 14px;
}

.calc-result-val {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-neon);
}

.calc-table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.calc-table th, .calc-table td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.calc-table th {
  color: var(--text-sub);
}

/* ==========================================================================
   Rest Timer Modal & Web Audio Pulse Animation
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 7, 13, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.timer-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius-xl);
  padding: 30px 24px;
  width: 85%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.25);
  transform: scale(0.8);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .timer-modal-content {
  animation: modalPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalPopIn {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Timer Ring Circular Animation */
.timer-ring-wrapper {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 20px auto;
}

.timer-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring-circle-bg {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 8;
  fill: transparent;
}

.timer-ring-circle-progress {
  stroke: var(--accent-cyan);
  stroke-width: 8;
  stroke-linecap: round;
  fill: transparent;
  stroke-dasharray: 440;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.timer-ring-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -1px;
}

/* Bell Pulse Animation when finished */
.bell-pulse-icon {
  width: 60px;
  height: 60px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 15px auto;
  color: #080c14;
}

.bell-pulse-icon.ringing {
  animation: bellPulse 0.8s ease-in-out infinite;
}

@keyframes bellPulse {
  0% { transform: scale(1) rotate(0deg); box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.7); }
  15% { transform: scale(1.15) rotate(15deg); }
  30% { transform: scale(1.15) rotate(-15deg); }
  45% { transform: scale(1.15) rotate(10deg); }
  60% { transform: scale(1.15) rotate(-10deg); }
  75% { transform: scale(1.05) rotate(5deg); box-shadow: 0 0 0 20px rgba(0, 255, 135, 0); }
  100% { transform: scale(1) rotate(0deg); }
}

.modal-btns {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-btn-secondary {
  flex: 1;
  padding: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================================================
   Bottom Navigation Bar (Mobile First - 4 Tabs)
   ========================================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  height: var(--nav-height);
  background: rgba(10, 15, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 900;
  padding: 0 6px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-sub);
  font-family: var(--font-main);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 6px 12px;
  border-radius: 12px;
  flex: 1;
}

.nav-item i {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.nav-item.active {
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.08);
}

.nav-item.active i {
  transform: translateY(-2px);
}

/* Floating Rest Action Button on Nav */
.floating-rest-pill {
  position: fixed;
  bottom: calc(var(--nav-height) + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gradient-primary);
  color: #080c14;
  padding: 8px 18px;
  border-radius: 30px;
  font-weight: 800;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0, 229, 255, 0.5);
  cursor: pointer;
  z-index: 850;
  transition: all 0.3s ease;
}

.floating-rest-pill:hover {
  transform: translateX(-50%) scale(1.05);
}

/* Notification Toast */
.toast-msg {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--bg-card);
  border: 1px solid var(--accent-neon);
  color: var(--accent-neon);
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--neon-green-shadow);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 2000;
}

.toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
