:root {
  /* Dark Neon Colors */
  --bg-color: #0d0f14;
  --bg-gradient: linear-gradient(135deg, #0d0f14 0%, #151821 100%);
  --glass-bg: rgba(30, 35, 48, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);

  --primary: #00ff88;
  /* Vibrant Neon Green */
  --primary-glow: rgba(0, 255, 136, 0.4);
  --primary-dark: #00cc6a;

  --secondary: #00e1ff;
  /* Accent Blue/Cyan */
  --secondary-glow: rgba(0, 225, 255, 0.4);

  /* Macro Colors */
  --macro-prot: #ff4757;
  /* Red/Pink */
  --macro-carb: #1e90ff;
  /* Blue */
  --macro-fat: #ffa502;
  /* Orange */

  --text-main: #f0f4f8;
  --text-muted: #8b95a5;
  --danger: #ff4757;

  --border-radius-lg: 20px;
  --border-radius-md: 14px;
  --border-radius-sm: 8px;

  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', 'Rubik', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  padding-bottom: 80px;
  /* Space for bottom nav */
}

/* Base Styles */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  color: var(--text-main);
}

p {
  color: var(--text-muted);
  line-height: 1.5;
}

.text-primary {
  color: var(--primary) !important;
}

.text-secondary {
  color: var(--secondary) !important;
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-center {
  text-align: center;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-3 {
  margin-top: 1rem;
}

.mt-4 {
  margin-top: 1.5rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-3 {
  margin-bottom: 1rem;
}

.mb-4 {
  margin-bottom: 1.5rem;
}

.w-100 {
  width: 100%;
}

.d-flex {
  display: flex;
}

.justify-between {
  justify-content: space-between;
}

.align-center {
  align-items: center;
}

.hidden {
  display: none !important;
}

.text-sm {
  font-size: 0.85rem;
}

/* Glassmorphism Classes */
.glass-header {
  background: rgba(13, 15, 20, 0.95);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.glass-card {
  background: rgba(30, 35, 48, 0.85);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* Header Elements */
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo i {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.logo span {
  color: var(--primary);
}

.user-greeting {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.user-greeting span {
  font-weight: 500;
  font-size: 0.95rem;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-color);
  font-size: 1.2rem;
  box-shadow: 0 0 15px var(--primary-glow);
}

/* Main Layout */
.app-container {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

main {
  padding: 1.5rem;
}

.section-header {
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.section-header h2 i {
  color: var(--secondary);
}

/* Views Logic */
.view {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  background: rgba(13, 15, 20, 0.98);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-around;
  padding: 0.8rem 0;
  z-index: 100;
  border-radius: 20px 20px 0 0;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: var(--transition);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-md);
}

.nav-item i {
  font-size: 1.3rem;
  transition: var(--transition);
}

.nav-item span {
  font-size: 0.75rem;
  font-weight: 500;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active i {
  transform: translateY(-2px);
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.nav-item:hover:not(.active) {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

/* Buttons */
button {
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}

.btn-primary,
.btn-success {
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 0.8rem 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover,
.btn-success:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  border-radius: var(--border-radius-md);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

/* Planner Specific */
.days-slider {
  display: flex;
  overflow-x: auto;
  gap: 0.8rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  scrollbar-width: none;
  /* Firefox */
}

.days-slider::-webkit-scrollbar {
  display: none;
  /* Chrome/Safari/Webkit */
}

.day-pill {
  min-width: 70px;
  padding: 0.8rem 0.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.day-pill .day-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  display: block;
}

.day-pill .day-date {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  display: block;
}

.day-pill.active {
  background: rgba(0, 225, 255, 0.15);
  border-color: var(--secondary);
  box-shadow: 0 0 15px var(--secondary-glow);
}

.day-pill.active .day-name,
.day-pill.active .day-date {
  color: var(--secondary);
}

.day-pill.has-workout::after {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  margin: 0.4rem auto 0;
  box-shadow: 0 0 5px var(--primary-glow);
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked+.slider {
  background-color: var(--secondary);
}

input:checked+.slider:before {
  transform: translateX(22px);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

.rest-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Exercises List */
.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.exercise-item {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.exercise-info h4 {
  margin-bottom: 0.3rem;
  font-size: 1.05rem;
}

.exercise-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.exercise-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-delete {
  background: rgba(255, 71, 87, 0.1);
  color: var(--danger);
}

.btn-delete:hover {
  background: rgba(255, 71, 87, 0.2);
}

/* empty states */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--glass-bg);
  border-radius: var(--border-radius-lg);
  border: 1px dashed var(--glass-border);
}

.empty-state i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  margin-bottom: 0.5rem;
}

/* Tracker Specific */
.tracker-days-slider {
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

.tracking-card {
  margin-bottom: 1.5rem;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--primary));
  border-radius: 4px;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px var(--primary-glow);
}

.track-item {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  margin-bottom: 1rem;
  overflow: hidden;
}

.track-item-header {
  padding: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.3s ease;
}

.track-item-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.track-item-header-content {
  flex: 1;
}

.track-item-chevron {
  color: var(--text-muted);
  transition: transform 0.3s ease;
  margin-right: 1rem;
}

.track-item.open .track-item-chevron {
  transform: rotate(180deg);
}

.sets-container {
  display: none;
  padding: 0 1.2rem 1.2rem 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.1);
}

.track-item.open .sets-container {
  display: block;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.last-weight-badge {
  background: rgba(0, 225, 255, 0.1);
  color: var(--secondary);
  border: 1px solid rgba(0, 225, 255, 0.2);
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.set-row {
  display: grid;
  grid-template-columns: 1fr 2fr 2fr 48px;
  gap: 0.8rem;
  align-items: center;
  padding: 0.8rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.set-row:last-child {
  border-bottom: none;
}

.set-number {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
}

.track-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  color: white;
  padding: 0.6rem;
  width: 100%;
  text-align: center;
  font-size: 1rem;
  transition: var(--transition);
}

.track-input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 8px rgba(0, 225, 255, 0.2);
}

.btn-check-set {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-check-set.completed {
  background: rgba(0, 255, 136, 0.15);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  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;
}

.modal-content {
  width: 90%;
  max-width: 400px;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.btn-close:hover {
  color: white;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.input-group input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  color: white;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  width: 100%;
  min-width: 0;
}

.input-group input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 10px rgba(0, 225, 255, 0.2);
}

.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Analytics Specific */
.bmi-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--secondary);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--secondary-glow);
  background: rgba(0, 225, 255, 0.05);
}

.bmi-circle span {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
}

.stats-row:last-child {
  border-bottom: none;
}

.stat-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1;
}

.stat-diff {
  flex: 1;
  text-align: center;
}

.stat-val-group {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.8rem;
}

.stat-value {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--primary);
}

.btn-delete-small {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: var(--transition);
}

.btn-delete-small:hover {
  opacity: 1;
  color: var(--danger);
  background: rgba(255, 71, 87, 0.1);
}

/* Nutrition Specific */
.nutrition-days-slider {
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

.macros-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.macro-item {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius-sm);
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.macro-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  font-weight: 500;
}

.macro-progress-bg {
  height: 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 5px;
}

.macro-cals-bar {
  background: linear-gradient(90deg, #00cc6a, var(--primary));
  box-shadow: 0 0 8px var(--primary-glow);
}

.macro-prot-bar {
  background: linear-gradient(90deg, #ff6b81, var(--macro-prot));
  box-shadow: 0 0 8px rgba(255, 71, 87, 0.4);
}

.macro-carb-bar {
  background: linear-gradient(90deg, #70a1ff, var(--macro-carb));
  box-shadow: 0 0 8px rgba(30, 144, 255, 0.4);
}

.macro-fat-bar {
  background: linear-gradient(90deg, #ff7f50, var(--macro-fat));
  box-shadow: 0 0 8px rgba(255, 165, 2, 0.4);
}

.macro-text-cals {
  color: var(--primary);
}

.macro-text-prot {
  color: var(--macro-prot);
}

.macro-text-carb {
  color: var(--macro-carb);
}

.macro-text-fat {
  color: var(--macro-fat);
}

.meal-item {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  padding: 1rem;
  margin-bottom: 0.8rem;
}

.meal-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.meal-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.meal-macros {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.meal-macro-val {
  font-weight: 600;
}

.meal-cals-val {
  color: var(--primary);
  font-weight: 600;
}

.favorite-meals-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.fav-meal-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-sm);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-add-fav {
  background: rgba(0, 255, 136, 0.1);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--border-radius-sm);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-add-fav:hover {
  background: var(--primary);
  color: #000;
}

/* --- Analytics Dashboard --- */
.analytics-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .analytics-dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.analytics-highlight-card {
  background: linear-gradient(135deg, rgba(30, 35, 48, 0.9), rgba(13, 15, 20, 0.95));
  border: 1px solid var(--glass-border);
  position: relative;
  overflow: hidden;
}

.analytics-highlight-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 71, 87, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

@keyframes flame-flicker {
  0% {
    transform: scale(1) rotate(-2deg);
    filter: drop-shadow(0 0 10px var(--danger)) brightness(1);
  }

  50% {
    transform: scale(1.1) rotate(2deg);
    filter: drop-shadow(0 0 15px var(--danger)) brightness(1.2);
  }

  100% {
    transform: scale(1) rotate(-2deg);
    filter: drop-shadow(0 0 10px var(--danger)) brightness(1);
  }
}

.fa-fire.text-danger {
  animation: flame-flicker 2s infinite ease-in-out;
}

/* --- Nutrition Calculator View --- */
#view-nutrition-calc .input-group input {
  padding: 0.8rem;
  font-size: 1.1rem;
}

#view-nutrition-calc .grid-2-col {
  column-gap: 1.5rem;
  row-gap: 1.5rem;
}

#calc-res-cals,
#calc-res-prot,
#calc-res-carb,
#calc-res-fat {
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}