/* ═══════════════════════════════════════════════════
   FitOS — AI Fitness Operating System
   Premium Dark Theme with Glassmorphism
   ═══════════════════════════════════════════════════ */

/* ── CSS Custom Properties ─────────────────────── */
:root {
  /* Colors */
  --bg-deep: #0a0a0f;
  --bg-primary: #0f0f18;
  --bg-secondary: #151520;
  --bg-card: rgba(22, 22, 35, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);

  --accent-primary: #6c5ce7;
  --accent-secondary: #a29bfe;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --accent-gradient: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 50%, #74b9ff 100%);
  --accent-gradient-warm: linear-gradient(135deg, #fd79a8 0%, #e17055 100%);
  --accent-gradient-green: linear-gradient(135deg, #00b894 0%, #55efc4 100%);
  --accent-gradient-blue: linear-gradient(135deg, #0984e3 0%, #74b9ff 100%);

  --text-primary: #e8e8f0;
  --text-secondary: #8888a0;
  --text-muted: #555570;
  --text-accent: #a29bfe;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(108, 92, 231, 0.3);

  --coach-color: #6c5ce7;
  --diet-color: #00b894;
  --progress-color: #fdcb6e;

  /* Spacing */
  --sidebar-width: 240px;
  --sidebar-collapsed: 68px;
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px var(--accent-glow);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ──────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ── Splash Screen ─────────────────────────────── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.splash.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-content {
  text-align: center;
  animation: splashIn 0.8s ease-out;
}

@keyframes splashIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.splash-logo {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
}

.logo-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent-primary);
  border-right-color: var(--accent-secondary);
  animation: spin 1.5s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.logo-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.splash-title {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -2px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.splash-sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 4px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.splash-loader {
  width: 200px;
  height: 3px;
  background: var(--bg-secondary);
  border-radius: 3px;
  margin: 32px auto 0;
  overflow: hidden;
}

.loader-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: 3px;
  animation: loading 2s ease-in-out forwards;
}

@keyframes loading {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 100%; }
}

/* ── App Layout ────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.app.hidden {
  display: none;
}

.accent {
  color: var(--accent-primary);
  -webkit-text-fill-color: var(--accent-primary);
}

/* ── Sidebar ───────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-normal), min-width var(--transition-normal);
  z-index: 100;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

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

.brand-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.brand-text {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -1px;
  white-space: nowrap;
}

.sidebar-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.sidebar-btn:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(108, 92, 231, 0.12);
  color: var(--accent-secondary);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--accent-primary);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .brand-text,
.sidebar.collapsed .status-text {
  display: none;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
}

.agent-status {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00b894;
  flex-shrink: 0;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 184, 148, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(0, 184, 148, 0); }
}

.status-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Main Content ──────────────────────────────── */
.main-content {
  flex: 1;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  position: relative;
}

/* Subtle grid background */
.main-content::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(108, 92, 231, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(116, 185, 255, 0.03) 0%, transparent 50%);
  pointer-events: none;
}

/* ── Panels ────────────────────────────────────── */
.panel {
  display: none;
  flex-direction: column;
  height: 100%;
  position: relative;
  z-index: 1;
}

.panel.active {
  display: flex;
}

.panel-header {
  height: var(--header-height);
  min-height: var(--header-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 15, 24, 0.8);
  backdrop-filter: blur(20px);
}

.panel-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.panel-badge {
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: var(--radius-full);
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-secondary);
  border: 1px solid rgba(108, 92, 231, 0.2);
}

.panel-badge.coach {
  background: rgba(108, 92, 231, 0.15);
  color: #a29bfe;
  border-color: rgba(108, 92, 231, 0.2);
}

.panel-badge.diet {
  background: rgba(0, 184, 148, 0.15);
  color: #55efc4;
  border-color: rgba(0, 184, 148, 0.2);
}

.panel-badge.progress {
  background: rgba(253, 203, 110, 0.15);
  color: #ffeaa7;
  border-color: rgba(253, 203, 110, 0.2);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-accent);
}

/* ── Chat ──────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: messageIn 0.3s ease-out;
}

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

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.message.assistant .message-avatar {
  background: var(--accent-gradient);
  box-shadow: var(--shadow-glow);
}

.message.user .message-avatar {
  background: rgba(255, 255, 255, 0.08);
}

.message-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message.assistant .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
}

.message.user .message-bubble {
  background: var(--accent-primary);
  color: white;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

/* ── Chat Input ────────────────────────────────── */
.chat-input-area {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(15, 15, 24, 0.5);
  backdrop-filter: blur(20px);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 8px 8px 8px 18px;
  transition: var(--transition-fast);
}

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

#chat-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  outline: none;
  padding: 6px 0;
}

#chat-input::placeholder {
  color: var(--text-muted);
}

.btn-send {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--accent-gradient);
  color: white;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.btn-send:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

.btn-send:active {
  transform: scale(0.95);
}

/* ── Buttons ───────────────────────────────────── */
.btn-primary {
  padding: 10px 20px;
  border: none;
  background: var(--accent-gradient);
  color: white;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-sparkle {
  font-size: 1rem;
}

/* ── Cards & Grid ──────────────────────────────── */
.card-grid {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(10px);
  transition: var(--transition-fast);
}

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

.glass-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Workout Cards ─────────────────────────────── */
.workout-grid {
  display: grid;
  gap: 16px;
}

.workout-day-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition-fast);
}

.workout-day-card:hover {
  border-color: var(--coach-color);
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.1);
}

.day-header {
  padding: 16px 20px;
  background: rgba(108, 92, 231, 0.08);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.day-header h4 {
  font-weight: 700;
  color: var(--accent-secondary);
}

.day-header .duration {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.exercise-list {
  padding: 16px 20px;
}

.exercise-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.85rem;
  align-items: center;
}

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

.exercise-name {
  font-weight: 600;
  color: var(--text-primary);
}

.exercise-detail {
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  text-align: center;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
}

/* ── Nutrition Cards ───────────────────────────── */
.nutrition-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.macro-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.macro-card .macro-value {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.macro-card .macro-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

.meal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  transition: var(--transition-fast);
}

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

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

.meal-header h4 {
  font-weight: 700;
  color: #55efc4;
}

.meal-cals {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(0, 184, 148, 0.1);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.meal-ingredients {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.meal-ingredients li {
  font-size: 0.8rem;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

.meal-steps {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.meal-steps ol {
  padding-left: 20px;
}

/* ── Progress Panel ────────────────────────────── */
.progress-layout {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.progress-form-card {
  grid-column: 1;
  grid-row: 1;
}

.progress-analysis-card {
  grid-column: 2;
  grid-row: 1 / -1;
}

.progress-history-card {
  grid-column: 1;
  grid-row: 2;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
  margin-bottom: 12px;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input[type="number"],
.form-group textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-fast);
}

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

.form-group input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  outline: none;
}

.form-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
}

.range-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--accent-secondary);
  text-align: center;
}

.analysis-result {
  margin-top: 16px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.history-entry .date {
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
}

.history-entry .weight {
  font-weight: 700;
  color: var(--accent-secondary);
}

/* ── Profile Panel ─────────────────────────────── */
.profile-layout {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
}

.profile-card .profile-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.profile-card .profile-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Empty State ───────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.85rem;
  max-width: 400px;
}

/* ── Loading Overlay ───────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(8px);
}

.loading-overlay.hidden {
  display: none;
}

.loading-content {
  text-align: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

.loading-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  animation: loadingTextPulse 2s ease-in-out infinite;
}

@keyframes loadingTextPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ── Muted text ────────────────────────────────── */
.muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Welcome message ───────────────────────────── */
.welcome-message {
  text-align: center;
  padding: 40px 20px;
}

.welcome-message h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-message p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 1024px) {
  .progress-layout {
    grid-template-columns: 1fr;
  }
  .progress-analysis-card {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-content {
    width: 100%;
  }

  .panel-header {
    padding: 0 16px;
  }

  .chat-messages {
    padding: 16px;
  }

  .chat-input-area {
    padding: 12px 16px 16px;
  }

  .message {
    max-width: 92%;
  }

  .card-grid {
    padding: 16px;
  }

  .progress-layout {
    padding: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .nutrition-overview {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Utility ───────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Meal section toggle ───────────────────────── */
.section-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.section-toggle button {
  padding: 8px 16px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
}

.section-toggle button.active {
  background: rgba(0, 184, 148, 0.15);
  color: #55efc4;
  border-color: rgba(0, 184, 148, 0.3);
}

/* ── Coach notes card ──────────────────────────── */
.coach-notes {
  background: rgba(108, 92, 231, 0.06);
  border: 1px solid rgba(108, 92, 231, 0.15);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.coach-notes strong {
  color: var(--accent-secondary);
}

/* ── Analysis result cards ─────────────────────── */
.analysis-card {
  background: rgba(253, 203, 110, 0.06);
  border: 1px solid rgba(253, 203, 110, 0.15);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.analysis-card h4 {
  color: #ffeaa7;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.analysis-card ul {
  list-style: none;
  padding: 0;
}

.analysis-card li {
  font-size: 0.83rem;
  color: var(--text-secondary);
  padding: 3px 0;
}

.analysis-card li::before {
  content: '→ ';
  color: var(--progress-color);
}

.motivation-banner {
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  margin-top: 12px;
}

/* Mobile menu toggle */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 300;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ── Auth Screen ───────────────────────────────── */
.auth-wrapper {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 1000;
  padding: 20px;
}

.auth-wrapper::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(108, 92, 231, 0.15) 0%, transparent 50%);
  animation: pulseBg 15s infinite;
  z-index: -1;
  pointer-events: none;
}

@keyframes pulseBg {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  background: rgba(15, 15, 24, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-lg);
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header .logo-icon {
  position: static;
  display: block;
  font-size: 4rem;
  margin-bottom: 20px;
  text-shadow: var(--shadow-glow);
  animation: pulse 2s ease-in-out infinite;
}

.auth-header h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 5px;
  letter-spacing: -0.5px;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.auth-form.active {
  display: flex;
  animation: formFadeIn 0.3s ease;
}

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

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

.auth-form .input-group input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.auth-form .input-group input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.15);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.auth-form .input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-btn {
  width: 100%;
  padding: 16px;
  font-size: 1rem;
  justify-content: center;
  margin-top: 10px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.auth-switch {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.auth-switch a {
  color: var(--accent-secondary);
  text-decoration: none;
  font-weight: 600;
  margin-left: 5px;
  transition: var(--transition-fast);
}

.auth-switch a:hover {
  text-decoration: underline;
  color: var(--accent-primary);
}
