/* BMM Challenge App — Shared Styles */
:root {
  --navy: #1a2332;
  --navy-light: #243447;
  --green: #2ecc71;
  --green-dark: #27ae60;
  --gold: #f39c12;
  --red: #e74c3c;
  --slate: #64748b;
  --text: #1e293b;
  --text-light: #94a3b8;
  --bg: #f8fafc;
  --white: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
}

/* Typography */
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.375rem; font-weight: 600; }
h3 { font-size: 1.125rem; font-weight: 600; }
p { margin-bottom: 0.75rem; }

/* Layout */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
  padding-bottom: 80px;
}

.app-header {
  background: var(--navy);
  color: var(--white);
  padding: 16px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 { font-size: 1.25rem; }
.app-header .subtitle { font-size: 0.8rem; color: var(--text-light); margin-top: 2px; }

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: box-shadow 0.2s, transform 0.2s;
}

@media (hover: hover) {
  .card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
  }
}

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

.card h2 { margin-bottom: 8px; }
.card h3 { margin-bottom: 6px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  gap: 8px;
}

.btn-primary {
  background: var(--green);
  color: var(--white);
}
.btn-primary:hover { background: var(--green-dark); }

.btn-secondary {
  background: var(--navy);
  color: var(--white);
}
.btn-secondary:hover { background: var(--navy-light); }

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--border);
}
.btn-outline:hover { border-color: var(--navy); }

.btn-full { width: 100%; }

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

/* Forms */
.form-group {
  margin-bottom: 16px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.15);
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* Pillar badges */
.pillar-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pillar-financial { background: #d4edda; color: #155724; }
.pillar-physical { background: #cce5ff; color: #004085; }
.pillar-psychological { background: #f8d7da; color: #721c24; }
.pillar-mindset { background: #e2e3e5; color: #383d41; }
.pillar-integration { background: #fff3cd; color: #856404; }
.pillar-reflection { background: #d1ecf1; color: #0c5460; }
.pillar-recap { background: #d6d8db; color: #1b1e21; }

/* Day indicator */
.day-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.day-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
}

.phase-label {
  font-size: 0.8rem;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Streak */
.streak-display {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--gold);
  font-weight: 600;
}

/* Slider/Range */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green);
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* Checkbox */
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

.check-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--green);
  cursor: pointer;
}

.check-item label {
  font-size: 0.95rem;
  cursor: pointer;
  flex: 1;
}

/* Breathing Timer */
.breathing-container {
  text-align: center;
  padding: 20px;
}

.breathing-circle {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 4px solid var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px auto;
  transition: transform 4s ease-in-out;
  position: relative;
}

.breathing-circle.inhale { transform: scale(1.3); }
.breathing-circle.hold { transform: scale(1.3); }
.breathing-circle.exhale { transform: scale(1); }
.breathing-circle.hold-out { transform: scale(1); }

.breathing-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--navy);
}

.breathing-count {
  font-size: 3rem;
  font-weight: 700;
  color: var(--green);
}

.breathing-cycle {
  font-size: 0.875rem;
  color: var(--slate);
  margin-top: 12px;
}

/* Savings Tracker */
.savings-display {
  text-align: center;
  padding: 16px;
}

.savings-amount {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--green);
}

.savings-goal {
  font-size: 0.875rem;
  color: var(--slate);
}

.savings-bar {
  margin: 12px 0;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0;
}

.stat-card {
  text-align: center;
  padding: 12px 8px;
  background: var(--bg);
  border-radius: var(--radius);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Auth screens */
.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--navy);
  color: var(--white);
}

.auth-screen .logo { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.auth-screen .tagline { color: var(--text-light); margin-bottom: 32px; font-size: 0.9rem; }

.auth-box {
  background: var(--white);
  color: var(--text);
  padding: 28px;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.auth-box h2 { margin-bottom: 20px; text-align: center; }

.auth-toggle {
  text-align: center;
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--slate);
}

.auth-toggle a {
  color: var(--green);
  text-decoration: none;
  font-weight: 600;
}

.error-msg {
  background: #fef2f2;
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 12px;
  display: none;
}

.error-msg.visible { display: block; }

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.65rem;
  color: var(--slate);
  text-decoration: none;
  padding: 4px 12px;
  cursor: pointer;
  border: none;
  background: none;
}

.nav-item.active { color: var(--green); }
.nav-item svg { width: 22px; height: 22px; }

/* Sections / Views */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.25s ease; }

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

/* Micro-animations */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.stat-value { transition: all 0.3s; }
.streak-pulse { animation: pulse 0.6s ease; }

/* Day navigation */
#day-prev, #day-next {
  min-width: 40px;
  min-height: 40px;
}

/* Responsive */
@media (min-width: 640px) {
  .app-container { padding: 0 24px; }
  h1 { font-size: 2rem; }
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--slate);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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

/* Dark mode */
body.dark {
  --navy: #0f1923;
  --navy-light: #1a2a3c;
  --text: #e2e8f0;
  --text-light: #64748b;
  --bg: #111827;
  --white: #1e293b;
  --border: #334155;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
}

body.dark .auth-box { background: var(--white); color: var(--text); }
body.dark .auth-screen { background: var(--navy); }
body.dark .error-msg { background: #1c1917; }
body.dark input, body.dark select, body.dark textarea { background: var(--bg); color: var(--text); border-color: var(--border); }
body.dark .bottom-nav { background: #0f172a; border-color: var(--border); }
body.dark .stat-card { background: var(--bg); }
body.dark .participant-table th { background: var(--bg); }

/* Progress Ring */
.progress-ring {
  width: 120px;
  height: 120px;
  margin: 0 auto 12px;
}

.progress-ring circle {
  transition: stroke-dashoffset 1s ease;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.progress-ring-text {
  font-size: 1.5rem;
  font-weight: 700;
  fill: var(--navy);
}

.progress-ring-label {
  font-size: 0.6rem;
  fill: var(--slate);
  text-transform: uppercase;
}

/* Badges */
.badge-item {
  text-align: center;
  width: 72px;
}

.badge-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 4px;
  border: 3px solid var(--border);
  background: var(--bg);
  transition: all 0.3s;
}

.badge-item.earned .badge-icon {
  border-color: var(--gold);
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

.badge-item.locked .badge-icon {
  opacity: 0.35;
  filter: grayscale(1);
}

.badge-label {
  font-size: 0.65rem;
  color: var(--slate);
  font-weight: 600;
}

.badge-item.earned .badge-label {
  color: var(--gold);
}

/* Confetti */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confetti-fall 2.5s ease-out forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Video embed */
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  margin: 12px 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

.video-container iframe,
.video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.video-placeholder {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-light);
  color: var(--text-light);
  font-size: 0.875rem;
}
