/* ==========================================================================
   CalisMotion Design System & Glassmorphism Aesthetics
   ========================================================================== */

:root {
  --bg-dark: #0a0e17;
  --bg-card: rgba(22, 28, 45, 0.65);
  --bg-card-hover: rgba(30, 40, 65, 0.8);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(0, 242, 254, 0.3);

  --accent-cyan: #00f2fe;
  --accent-emerald: #00f5a0;
  --accent-coral: #ff5e62;
  --accent-amber: #ffb199;
  
  --text-main: #f0f4fc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;

  --backdrop-blur: blur(16px);
  --shadow-glow: 0 10px 30px rgba(0, 242, 254, 0.15);
}

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

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(0, 242, 254, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(0, 245, 160, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(255, 94, 98, 0.04) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* App Container */
#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem 5rem 1rem;
}

/* Navbar Navigation */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-emerald));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
}

.nav-item {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  color: var(--bg-dark);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-emerald));
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

/* Glass Card Common */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), #00b4d8);
  color: #050b14;
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 242, 254, 0.5);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-emerald), #00b894);
  color: #050b14;
  box-shadow: 0 4px 20px rgba(0, 245, 160, 0.3);
}
.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 245, 160, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-outline-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}
.btn-outline-sm:hover {
  color: var(--text-main);
  border-color: var(--accent-cyan);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}
.btn-xl {
  padding: 1.25rem 2.5rem;
  font-size: 1.25rem;
  border-radius: var(--radius-lg);
}

.pulse {
  animation: pulseGlow 2s infinite;
}
@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(0, 245, 160, 0.6); }
  70% { box-shadow: 0 0 0 18px rgba(0, 245, 160, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 245, 160, 0); }
}

/* Onboarding Component */
.onboarding-wrapper {
  max-width: 700px;
  margin: 2rem auto;
}
.onboarding-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.logo-mark {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
}
.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.step-progress-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.step-indicator {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.3s ease;
}
.step-indicator.active {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}
.step-line {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  max-width: 50px;
  transition: all 0.3s ease;
}
.step-line.active {
  background: var(--accent-cyan);
}

.form-label {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}
.form-input {
  width: 100%;
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-md);
  background: rgba(10, 14, 23, 0.7);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.25s ease;
}
.form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}
.option-card {
  padding: 1.25rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.option-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}
.option-card.selected {
  background: rgba(0, 242, 254, 0.12);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.2);
}
.opt-icon { font-size: 2rem; }
.opt-title { font-weight: 700; font-size: 1rem; color: var(--text-main); }
.opt-desc { font-size: 0.82rem; color: var(--text-muted); }

.onboarding-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* Weekly Plan View */
.user-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.avatar-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-emerald));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #000;
}
.highlight-badge {
  color: var(--accent-cyan);
  font-weight: 700;
}
.user-stats-strip {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.stat-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.stat-num { font-weight: 800; font-size: 1.1rem; }
.stat-lbl { font-size: 0.75rem; color: var(--text-muted); }

/* Day Selector Strip */
.day-selector-container {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.day-tab {
  padding: 1rem 0.5rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}
.day-tab:hover {
  border-color: rgba(255, 255, 255, 0.3);
}
.day-tab.active {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.2), rgba(0, 245, 160, 0.2));
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
}
.day-tab.done-tab {
  border-color: var(--accent-emerald);
  background: rgba(0, 245, 160, 0.12);
}
.day-tab.rest {
  opacity: 0.65;
}
.day-name { font-weight: 800; font-size: 0.9rem; }
.day-type { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Day Detail */
.day-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}
.day-metrics {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.exercise-row-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.2rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  transition: background 0.2s ease;
}
.exercise-row-card:hover {
  background: rgba(255, 255, 255, 0.06);
}
.ex-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-cyan);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ex-info { flex: 1; }
.ex-name { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 0.6rem; }
.cat-pill { font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 20px; font-weight: 600; }
.ex-target { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.2rem; }
.ex-muscles { display: flex; gap: 0.4rem; margin-top: 0.4rem; flex-wrap: wrap; }
.muscle-tag { font-size: 0.72rem; padding: 0.15rem 0.5rem; background: rgba(255, 255, 255, 0.06); border-radius: 4px; color: var(--text-muted); }

.day-launch-bar {
  margin-top: 2rem;
  text-align: center;
}

.rest-day-card {
  text-align: center;
  padding: 3rem 1rem;
}
.rest-icon { font-size: 4rem; margin-bottom: 1rem; }

/* SVG & Realistic Visualizer Card */
.visualizer-card {
  background: rgba(10, 14, 23, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.visualizer-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.visualizer-badge { color: var(--accent-cyan); font-weight: 700; }
.svg-stage, .realistic-stage {
  width: 100%;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Realistic Exercise Motion Container */
.realistic-motion-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 280px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-glow);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 242, 254, 0.15);
}
.motion-canvas, .exercise-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.motion-badge-floating {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 10;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 242, 254, 0.4);
  color: var(--accent-cyan);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.exercise-photo {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease-in-out, transform 0.8s ease;
}
.exercise-photo.active {
  opacity: 1;
  transform: scale(1.03);
}
.motion-pulse-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(0, 242, 254, 0.08) 0%, transparent 70%);
}
.motion-rhythm-bar {
  position: absolute;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 14, 23, 0.75);
  backdrop-filter: blur(8px);
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.rhythm-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}
.rhythm-dot.active {
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
  transform: scale(1.3);
}
.rhythm-line {
  width: 30px; height: 2px;
  background: rgba(255, 255, 255, 0.2);
}

.vector-svg {
  width: 100%;
  height: 100%;
  max-height: 260px;
}
.muscle-indicators {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.muscle-pill {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  border: 1px solid;
  font-weight: 600;
}

/* Workout Player Fullscreen Overlay */
.player-fullscreen-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(5, 8, 15, 0.95);
  backdrop-filter: blur(20px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.player-container {
  width: 100%;
  max-width: 950px;
  height: 100%;
  max-height: 700px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.session-progress-dots {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.3rem;
  justify-content: center;
}
.progress-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}
.progress-dot.active { background: var(--accent-cyan); box-shadow: 0 0 8px var(--accent-cyan); }
.progress-dot.done { background: var(--accent-emerald); }

.player-main { flex: 1; margin: 1.5rem 0; display: flex; align-items: center; justify-content: center; }
.player-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  width: 100%;
  align-items: center;
}
.player-side-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
}

.timer-ring-container {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto;
}
.ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.1); stroke-width: 8; }
.ring-progress {
  fill: none;
  stroke: var(--accent-cyan);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s linear;
}
.ring-text {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.big-num { font-size: 2.8rem; font-weight: 900; line-height: 1; }
.unit { font-size: 0.8rem; color: var(--text-muted); }

.instruction-box {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.instruction-box ul, .instruction-box ol { margin-left: 1.2rem; margin-top: 0.4rem; }

.player-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Player State Cards */
.player-card {
  text-align: center;
  padding: 3rem 2rem;
  max-width: 550px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}
.badge-status {
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-cyan);
  font-weight: 800;
  font-size: 0.85rem;
}
.ready-countdown-num { font-size: 6rem; font-weight: 900; color: var(--accent-cyan); margin: 0.5rem 0; }

.completion-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 2rem 0;
}
.stat-badge-card {
  background: rgba(255, 255, 255, 0.04);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* Library & Search */
.library-header { margin-bottom: 1.5rem; }
.filter-controls { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.cat-filter-pills { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pill-btn {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pill-btn.active {
  background: var(--accent-cyan);
  color: #000;
  font-weight: 700;
}

.exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.exercise-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.8rem;
}
.card-top { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; }
.diff-badge { padding: 0.2rem 0.5rem; border-radius: 4px; font-weight: 700; }
.diff-badge.beginner { background: rgba(0, 245, 160, 0.2); color: var(--accent-emerald); }
.diff-badge.intermediate { background: rgba(0, 242, 254, 0.2); color: var(--accent-cyan); }
.diff-badge.advanced { background: rgba(255, 94, 98, 0.2); color: var(--accent-coral); }

.card-title { font-size: 1.15rem; }
.card-desc { font-size: 0.85rem; color: var(--text-muted); }
.card-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; }

/* Modal Preview */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal-card {
  max-width: 800px;
  width: 100%;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: transparent; border: none;
  color: var(--text-muted); font-size: 1.5rem;
  cursor: pointer;
}
.modal-preview-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Progress Tracker */
.stats-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
}
.stat-icon { font-size: 2.2rem; }
.stat-value { font-size: 1.4rem; font-weight: 800; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }

.history-card { margin-top: 1.5rem; }
.history-list { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1rem; }
.history-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
}
.history-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 45px; height: 45px;
  border-radius: var(--radius-sm);
  background: rgba(0, 242, 254, 0.1);
  color: var(--accent-cyan);
}
.day-num { font-weight: 800; font-size: 1.1rem; line-height: 1; }
.month-txt { font-size: 0.65rem; text-transform: uppercase; }
.history-info { flex: 1; }
.history-meta { font-size: 0.85rem; color: var(--text-muted); }
.history-badge { color: var(--accent-emerald); font-weight: 700; font-size: 0.85rem; }

/* Animations */
.fade-in {
  animation: fadeIn 0.35s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  .day-selector-container { grid-template-columns: repeat(4, 1fr); }
  .player-grid, .modal-preview-layout { grid-template-columns: 1fr; }
  .user-banner { flex-direction: column; align-items: flex-start; }
}
