/**
 * AgingGracefully102 - HealthSpan Tracker
 * Main Stylesheet
 * 
 * Color scheme:
 * - Primary Green: #2D5A3D (nature/health)
 * - Accent Gold: #D4A84B (achievement/premium)
 * - Background: Dark navy gradients
 */

/* =========================================================================
   CSS VARIABLES
   ========================================================================= */
:root {
  --primary-green: #2D5A3D;
  --accent-gold: #D4A84B;
  --stability: #3B82F6;
  --mobility: #10B981;
  --strength: #EF4444;
  --power: #F59E0B;
  --cardio: #8B5CF6;
  --cognition: #EC4899;
  --bodycomp: #06B6D4;
  --surveys: #84CC16;
  --bg-dark: #0f0f23;
  --bg-card: rgba(255,255,255,0.08);
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.7);
  --text-muted: rgba(255,255,255,0.5);
}

/* =========================================================================
   RESET & BASE
   ========================================================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #0f0f23 100%);
  min-height: 100vh;
  color: var(--text-primary);
}

/* =========================================================================
   BACKGROUND GRID
   ========================================================================= */
.bg-grid {
  position: fixed; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none; z-index: 0;
}

#app { position: relative; z-index: 1; }

/* =========================================================================
   NAVIGATION
   ========================================================================= */
nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 2rem;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky; top: 0; z-index: 100;
}

.logo { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; }

.logo-img {
  width: 55px; height: 55px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(255,255,255,0.95);
  padding: 3px;
}

.logo-text { display: flex; flex-direction: column; }
.logo h1 { font-size: 1.1rem; font-weight: 700; line-height: 1.2; color: #fff; }
.logo h1 .num { color: var(--accent-gold); }
.logo .tagline { font-size: 0.7rem; color: var(--text-muted); font-weight: 400; }

.nav-links { display: flex; gap: 1rem; align-items: center; }

.nav-links button {
  color: var(--text-secondary);
  padding: 0.5rem 1rem; border-radius: 8px;
  transition: all 0.2s; background: none; border: none;
  font-size: 0.95rem; cursor: pointer;
}

.nav-links button:hover {
  color: var(--text-primary); background: rgba(255,255,255,0.1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-green), var(--accent-gold)) !important;
  color: white !important;
}

/* =========================================================================
   LAYOUT
   ========================================================================= */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.hidden { display: none !important; }

/* =========================================================================
   LANDING PAGE
   ========================================================================= */
.landing { text-align: center; padding: 4rem 2rem; }
.hero { max-width: 800px; margin: 0 auto; }

.hero-logo {
  width: 160px; height: 160px;
  margin: 0 auto 2rem;
  border-radius: 16px;
  background: rgba(255,255,255,0.95);
  padding: 8px;
  box-shadow: 0 20px 60px rgba(45, 90, 61, 0.3);
  object-fit: contain;
}

.hero h1 {
  font-size: 3rem; font-weight: 800; line-height: 1.1; margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.8) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p { font-size: 1.25rem; color: var(--text-secondary); margin-bottom: 2rem; line-height: 1.6; }

/* =========================================================================
   BUTTONS
   ========================================================================= */
.cta-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.btn {
  padding: 1rem 2rem; border-radius: 12px; font-size: 1.1rem;
  font-weight: 600; cursor: pointer; transition: all 0.3s; border: none;
}

.btn-large {
  background: linear-gradient(135deg, var(--primary-green), var(--accent-gold));
  color: white;
}

.btn-large:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(45, 90, 61, 0.4); }
.btn-outline { background: transparent; border: 2px solid rgba(255,255,255,0.3); color: white; }
.btn-outline:hover { border-color: white; background: rgba(255,255,255,0.1); }

/* =========================================================================
   PILLAR BADGES (Landing)
   ========================================================================= */
.pillars-preview { display: flex; justify-content: center; gap: 1rem; margin-top: 3rem; flex-wrap: wrap; }

.pillar-badge {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--bg-card); padding: 0.75rem 1.25rem;
  border-radius: 100px; border: 1px solid rgba(255,255,255,0.1);
}

.pillar-badge .dot { width: 12px; height: 12px; border-radius: 50%; }

/* =========================================================================
   FEATURE CARDS
   ========================================================================= */
.features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem; margin-top: 4rem;
}

.feature-card {
  background: var(--bg-card); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 20px;
  padding: 2rem; text-align: left;
}

.feature-card .icon { font-size: 2.5rem; margin-bottom: 1rem; }
.feature-card h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
.feature-card p { color: var(--text-secondary); line-height: 1.6; }

/* =========================================================================
   MODAL
   ========================================================================= */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
}

.modal {
  background: linear-gradient(135deg, #1a1a3e 0%, #0f0f23 100%);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 24px;
  padding: 2.5rem; width: 100%; max-width: 420px; position: relative;
  max-height: 90vh; overflow-y: auto;
}

.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; color: var(--text-muted);
  font-size: 1.5rem; cursor: pointer;
  z-index: 10;
}

.modal-logo {
  width: 90px; height: 90px;
  margin: 0 auto 1rem; display: block;
  border-radius: 14px;
  background: rgba(255,255,255,0.95);
  padding: 6px;
  object-fit: contain;
}

.modal h2 { text-align: center; margin-bottom: 0.5rem; }
.modal .subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 2rem; }

/* =========================================================================
   SUBSCRIPTION INFO (Profile Modal)
   ========================================================================= */
.subscription-info {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.subscription-info h3 {
  color: var(--accent-gold);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.subscription-details {
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.subscription-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.subscription-row:not(:last-child) {
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.subscription-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.subscription-value {
  color: var(--text-primary);
  font-weight: 500;
}

.subscription-value.status-active {
  color: var(--primary-green);
}

.subscription-value.status-warning {
  color: #f59e0b;
}

#btn-manage-subscription {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

#btn-manage-subscription:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--accent-gold);
}

#btn-manage-subscription:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* =========================================================================
   FORMS
   ========================================================================= */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--text-secondary); font-size: 0.9rem; }

.form-group input, .form-group select {
  width: 100%; padding: 0.875rem 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; color: white; font-size: 1rem;
}

.form-group select option { background: #1a1a3e; color: white; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary-green); }
.form-group input::placeholder { color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.btn-submit {
  width: 100%; padding: 1rem;
  background: linear-gradient(135deg, var(--primary-green), var(--accent-gold));
  border: none; border-radius: 10px; color: white;
  font-size: 1rem; font-weight: 600; cursor: pointer;
}

.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(45, 90, 61, 0.4); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.auth-switch { text-align: center; margin-top: 1.5rem; color: var(--text-secondary); }
.auth-switch button { background: none; border: none; color: var(--accent-gold); cursor: pointer; font-weight: 600; font-size: 1rem; }

.forgot-password { text-align: right; margin-top: -0.5rem; margin-bottom: 1rem; }
.forgot-password button { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.85rem; }
.forgot-password button:hover { color: var(--accent-gold); }

.back-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.9rem; margin-bottom: 1rem; }
.back-btn:hover { color: var(--text-primary); }

/* =========================================================================
   MESSAGES
   ========================================================================= */
.message { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; text-align: center; }
.message.error { background: rgba(239, 68, 68, 0.2); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }
.message.success { background: rgba(16, 185, 129, 0.2); border: 1px solid rgba(16, 185, 129, 0.3); color: #6ee7b7; }
.message.info { background: rgba(59, 130, 246, 0.2); border: 1px solid rgba(59, 130, 246, 0.3); color: #93c5fd; }

/* =========================================================================
   SPINNER
   ========================================================================= */
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3); border-radius: 50%;
  border-top-color: white; animation: spin 0.8s linear infinite;
  margin-right: 0.5rem; vertical-align: middle;
}

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

/* =========================================================================
   DASHBOARD HEADER
   ========================================================================= */
.dashboard-header { margin-bottom: 2rem; }
.dashboard-header h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.dashboard-header p { color: var(--text-secondary); }

/* =========================================================================
   MAIN SCORE SECTION
   ========================================================================= */
.main-score {
  background: var(--bg-card); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px; padding: 2rem; margin-bottom: 2rem; text-align: center;
}

.score-container { display: flex; flex-direction: column; align-items: center; gap: 1rem; }

.level-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: rgba(212, 168, 75, 0.2); border: 1px solid rgba(212, 168, 75, 0.3);
  border-radius: 100px; padding: 0.5rem 1.25rem; font-weight: 600;
}

.level-badge .icon { font-size: 1.25rem; }
.level-badge .text { color: var(--accent-gold); font-size: 0.9rem; letter-spacing: 0.05em; }

/* =========================================================================
   SCORE RING
   ========================================================================= */
.score-ring-wrapper { position: relative; width: 180px; height: 180px; }
.score-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.1); stroke-width: 12; }

.ring-progress {
  fill: none; stroke: url(#scoreGradient); stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 502;
  stroke-dashoffset: 502;
  transition: stroke-dashoffset 1.5s ease-out;
}

.score-ring.animated .ring-progress {
  stroke-dashoffset: calc(502 - (502 * var(--score) / 100));
}

.score-display {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}

.score-number { font-size: 3.5rem; font-weight: 800; line-height: 1; }
.score-label { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.25rem; }

/* =========================================================================
   FOCUS ALERT
   ========================================================================= */
.focus-alert {
  display: flex; align-items: center; gap: 0.75rem;
  background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 12px; padding: 0.75rem 1.25rem; margin-top: 1rem;
  font-size: 0.9rem; color: #fcd34d;
}

/* =========================================================================
   SECTION TITLES
   ========================================================================= */
.section-title {
  display: flex; align-items: center; gap: 1rem;
  margin: 2rem 0 1rem; flex-wrap: wrap;
}

.section-title h2 { font-size: 1.25rem; }

.section-title .badge {
  background: rgba(255,255,255,0.1); padding: 0.35rem 0.75rem;
  border-radius: 100px; font-size: 0.75rem; color: var(--text-muted);
}

/* =========================================================================
   PILLARS GRID
   ========================================================================= */
.pillars-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem;
}

.pillar-card {
  background: var(--bg-card); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px; padding: 1.5rem; text-align: center;
  position: relative; overflow: hidden;
}

.pillar-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--color);
}

.pillar-card.weakest { border-color: var(--color); }

.pillar-card.weakest::after {
  content: '← Focus'; position: absolute; top: 0.75rem; right: 0.75rem;
  background: var(--color); color: white; font-size: 0.65rem; font-weight: 600;
  padding: 0.2rem 0.5rem; border-radius: 4px;
}

.pillar-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.pillar-name { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 0.5rem; }
.pillar-score { font-size: 2rem; font-weight: 700; }
.pillar-bonus { font-size: 0.9rem; color: #10B981; margin-left: 0.25rem; }
.pillar-bar { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; margin-top: 0.75rem; overflow: hidden; }
.pillar-bar-fill { height: 100%; background: var(--color); border-radius: 3px; transition: width 1s ease-out; }

/* =========================================================================
   TRACKING GRID
   ========================================================================= */
.tracking-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem;
}

.tracking-card {
  background: var(--bg-card); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px; padding: 1.25rem;
}

.tracking-card-wide {
  grid-column: span 2;
}

.tracking-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 600px) {
  .tracking-card-wide {
    grid-column: span 1;
  }
  .tracking-columns {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

.tracking-card::before {
  content: ''; display: block; width: 40px; height: 3px;
  background: var(--color); border-radius: 2px; margin-bottom: 1rem;
}

.tracking-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.tracking-header .icon { font-size: 1.5rem; }
.tracking-header h3 { font-size: 1rem; }

.tracking-list { list-style: none; }

.tracking-item {
  display: flex; justify-content: space-between; padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.tracking-item:last-child { border-bottom: none; }
.tracking-item .label { color: var(--text-secondary); font-size: 0.9rem; }
.tracking-item .value { font-weight: 600; }

/* =========================================================================
   ACTIVITIES & FORMS SECTION
   ========================================================================= */
.activities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.activity-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 1.5rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.activity-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.2);
}

.activity-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.activity-icon {
  font-size: 1.5rem;
}

.activity-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.activity-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.activity-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.activity-status .status-label {
  color: var(--text-secondary);
}

.activity-status .status-value {
  font-weight: 600;
  color: var(--text-primary);
}

.activity-status.completed .status-value {
  color: var(--accent-green);
}

.activity-status.high-risk .status-value {
  color: #e74c3c;
}

.activity-status.moderate-risk .status-value {
  color: #f39c12;
}

.activity-status.low-risk .status-value {
  color: var(--accent-green);
}

.activity-actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.activity-link {
  color: #ffffff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
  cursor: pointer;
}

.activity-link:hover {
  color: var(--accent-gold);
  text-decoration: underline;
}

@media (max-width: 480px) {
  .activities-grid {
    grid-template-columns: 1fr;
  }

  .activity-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* =========================================================================
   COMING SOON / ASSESSMENT ACTIONS
   ========================================================================= */
.coming-soon {
  background: linear-gradient(135deg, rgba(45, 90, 61, 0.2), rgba(212, 168, 75, 0.1));
  border: 1px solid rgba(212, 168, 75, 0.3);
  border-radius: 16px; padding: 2rem; text-align: center; margin-top: 2rem;
}

.coming-soon h3 { margin-bottom: 0.5rem; color: var(--accent-gold); }
.coming-soon p { color: var(--text-secondary); }

.assessment-actions {
  background: linear-gradient(135deg, rgba(45, 90, 61, 0.3), rgba(212, 168, 75, 0.15));
  border: 1px solid rgba(212, 168, 75, 0.4);
  border-radius: 16px; padding: 2rem; text-align: center; margin-top: 2rem;
}

.assessment-actions h3 { margin-bottom: 0.5rem; color: var(--accent-gold); }
.assessment-actions p { color: var(--text-secondary); margin-bottom: 1.5rem; }
.assessment-actions .btn-row { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* =========================================================================
   DATA LOADING & ASSESSMENT SELECTOR
   ========================================================================= */
.data-loading {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  color: var(--text-muted); font-size: 0.9rem; padding: 1rem;
}

.assessment-selector {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; padding: 0.5rem 1rem; color: white; font-size: 0.9rem;
  margin-left: 0.5rem; cursor: pointer;
}

.assessment-selector option { background: #1a1a3e; }

/* =========================================================================
   USER MENU
   ========================================================================= */
.user-menu { position: relative; }

.user-menu-btn {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--bg-card); border: 1px solid rgba(255,255,255,0.1);
  padding: 0.5rem 1rem; border-radius: 100px; cursor: pointer; color: white;
}

.user-dropdown {
  position: absolute; top: calc(100% + 0.5rem); right: 0;
  background: #1a1a3e; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; padding: 0.5rem; min-width: 160px; z-index: 100;
}

.user-dropdown button {
  width: 100%; text-align: left; padding: 0.75rem 1rem;
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; border-radius: 8px; font-size: 0.9rem;
}

.user-dropdown button:hover { background: rgba(255,255,255,0.1); color: white; }
.user-dropdown hr { border: none; border-top: 1px solid rgba(255,255,255,0.1); margin: 0.25rem 0; }

/* =========================================================================
   WALKTHROUGH VIDEO SECTIONS
   ========================================================================= */

/* Dashboard Walkthrough (for logged-in users) */
.walkthrough-section {
  max-width: 720px;
  margin: 0 auto 2rem auto;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 16px;
}

.walkthrough-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.walkthrough-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.hide-walkthrough-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.hide-walkthrough-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

/* Landing Page Video Section */
.landing-video-section {
  text-align: center;
  padding: 3rem 1.5rem;
  margin-top: 2rem;
}

.landing-video-section h2 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.landing-video-description {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}

.landing-video {
  max-width: 720px;
  margin: 0 auto;
}

/* Video Wrapper (16:9 responsive) */
.walkthrough-video,
.landing-video {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
}

.walkthrough-video iframe,
.landing-video iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* =========================================================================
   FOOTER
   ========================================================================= */
footer {
  text-align: center; padding: 3rem 2rem; color: var(--text-muted); font-size: 0.85rem;
}

footer a { color: var(--accent-gold); text-decoration: none; }

/* Footer Feedback Links */
.footer-feedback {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
}

.feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.feedback-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-gold);
  color: var(--text-primary);
}

/* =========================================================================
   RESPONSIVE - PHASE 4 ENHANCEMENTS
   ========================================================================= */

/* Base Tablet & Mobile (768px and below) */
@media (max-width: 768px) {
  /* Navigation */
  nav {
    padding: 0.5rem 1rem;
    flex-wrap: wrap;
  }

  .logo h1 { font-size: 0.95rem; }
  .logo-img { width: 45px; height: 45px; }

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

  .nav-links button {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  /* Hero Section */
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1rem; }
  .hero-logo { width: 120px; height: 120px; }

  /* Walkthrough Video Section */
  .walkthrough-header {
    flex-direction: column;
    text-align: center;
  }

  .landing-video-section { padding: 2rem 1rem; }
  .landing-video-section h2 { font-size: 1.5rem; }

  /* Container & Layout */
  .container { padding: 1rem; }

  /* Buttons */
  .btn {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }

  .cta-buttons { gap: 0.75rem; }

  /* Dashboard Score */
  .score-ring-wrapper { width: 150px; height: 150px; }
  .score-number { font-size: 2.5rem; }

  /* Main Score Section */
  .main-score { padding: 1.5rem; }

  /* Pillars Grid - 2 columns on tablet */
  .pillars-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .pillar-card { padding: 1.25rem; }
  .pillar-icon { font-size: 1.75rem; }
  .pillar-score { font-size: 1.75rem; }

  /* Tracking Grid - Single column on tablet */
  .tracking-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Modals - Better spacing */
  .modal {
    width: 95vw;
    max-width: 95vw;
    max-height: 90vh;
    padding: 1.5rem;
    overflow-y: auto;
  }

  .modal-close {
    top: 0.75rem;
    right: 0.75rem;
    font-size: 1.75rem;
    /* Ensure tap target is 44px minimum */
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
  }

  /* Features Grid */
  .features {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .feature-card { padding: 1.5rem; }

  /* Section Titles */
  .section-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 1.5rem 0 1rem;
  }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
  /* Navigation - Even more compact */
  nav { padding: 0.5rem; }

  .logo h1 { font-size: 0.85rem; }
  .logo .tagline { font-size: 0.6rem; }
  .logo-img { width: 40px; height: 40px; }

  .nav-links button {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
  }

  /* Hero Section */
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 0.9rem; }
  .hero-logo { width: 100px; height: 100px; }
  .landing { padding: 2rem 1rem; }

  /* Container */
  .container { padding: 0.75rem; }

  /* Buttons */
  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
  }

  /* Dashboard Header */
  .dashboard-header h1 { font-size: 1.5rem; }

  /* Main Score */
  .main-score { padding: 1.25rem; }
  .score-ring-wrapper { width: 130px; height: 130px; }
  .score-number { font-size: 2.25rem; }
  .level-badge { padding: 0.4rem 1rem; font-size: 0.85rem; }

  /* Pillars Grid - Single column on small phones */
  .pillars-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .pillar-card { padding: 1rem; }
  .pillar-icon { font-size: 1.5rem; }
  .pillar-score { font-size: 1.5rem; }
  .pillar-name { font-size: 0.8rem; }

  /* Tracking Cards */
  .tracking-card { padding: 1rem; }
  .tracking-header .icon { font-size: 1.25rem; }
  .tracking-item { padding: 0.4rem 0; }
  .tracking-item .label { font-size: 0.85rem; }
  .tracking-item .value { font-size: 0.9rem; }

  /* Modal */
  .modal {
    padding: 1.25rem;
    border-radius: 16px;
  }

  .modal h2 { font-size: 1.5rem; }
  .modal-logo { width: 70px; height: 70px; }

  /* Form elements - Ensure touch-friendly */
  .form-group input,
  .form-group select {
    padding: 0.75rem;
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 44px; /* Touch target minimum */
  }

  /* Button touch targets */
  .btn,
  button {
    min-height: 44px;
    min-width: 44px;
  }

  /* Prevent text size adjustments on orientation change */
  body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  /* Focus Alert */
  .focus-alert {
    flex-direction: column;
    text-align: center;
    font-size: 0.85rem;
    padding: 0.65rem 1rem;
  }

  /* Coming Soon / Actions */
  .assessment-actions,
  .coming-soon {
    padding: 1.5rem;
  }

  .assessment-actions .btn-row {
    flex-direction: column;
    width: 100%;
  }

  .assessment-actions .btn-row .btn {
    width: 100%;
  }
}

/* Landscape Mobile (height constrained) */
@media (max-height: 600px) and (orientation: landscape) {
  .modal {
    max-height: 85vh;
    padding: 1rem;
  }

  .modal-logo {
    width: 60px;
    height: 60px;
    margin-bottom: 0.5rem;
  }

  .test-modal-your-score,
  .tracking-modal-your-value {
    margin-bottom: 1.5rem;
  }

  .your-score-card,
  .your-value-card {
    padding: 1rem 2rem !important;
  }

  .test-modal-viz,
  .test-modal-norms,
  .test-modal-research {
    margin-bottom: 1.5rem;
  }

  .test-modal-viz h3,
  .test-modal-norms h3,
  .test-modal-research h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
  }
}

/* ========================================================================= */
/* PILLAR DETAIL MODAL */
/* ========================================================================= */

.modal-wide {
  max-width: 800px;
  width: 90%;
}

.pillar-modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.pillar-modal-icon {
  font-size: 3rem;
  line-height: 1;
}

.pillar-modal-title-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.pillar-modal-title-group h2 {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 700;
}

.pillar-modal-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.4;
}

.pillar-modal-score {
  font-size: 4rem;
  font-weight: 800;
  background: linear-gradient(135deg, #2D5A3D, #3D7A4D, #D4A84B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  padding: 1rem 2rem;
  border-radius: 16px;
  background-color: rgba(212, 168, 75, 0.1);
  background-image: linear-gradient(135deg, #2D5A3D, #3D7A4D, #D4A84B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}

.pillar-modal-score::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: rgba(212, 168, 75, 0.12);
  z-index: -1;
}

/* Test List */
.test-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.test-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.test-item:nth-child(even) {
  background: rgba(255,255,255,0.05);
}

.test-item-clickable {
  cursor: pointer;
}

.test-item-clickable:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-1px);
}

.test-item-empty {
  opacity: 0.6;
}

.test-item-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.test-item-check {
  font-size: 1.25rem;
  line-height: 1;
  color: var(--accent-gold);
}

.test-item-name {
  font-weight: 500;
  font-size: 0.95rem;
}

.test-item-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: right;
}

.test-item-value {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.test-item-score {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.score-excellent {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.score-good {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.score-fair {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
}

.score-poor {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.test-item-link {
  color: var(--accent-gold);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.test-item-link:hover {
  color: var(--text-primary);
}

/* Calculated test items (like DTC) */
.test-item-calculated {
  border-left: 3px solid var(--accent-gold);
  background: rgba(212, 168, 75, 0.05);
}

.test-item-calculated .test-item-check {
  font-size: 1.1rem;
}

/* DTC Interpretation labels */
.test-item-interpretation {
  display: block;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}

.dtc-normal {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.dtc-mild {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.dtc-moderate {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
}

.dtc-severe {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.dtc-unknown {
  background: rgba(128, 128, 128, 0.15);
  color: #9ca3af;
}

/* LSI (Limb Symmetry Index) interpretation colors */
.lsi-normal {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.lsi-mild {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.lsi-significant {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.lsi-unknown {
  background: rgba(128, 128, 128, 0.15);
  color: #9ca3af;
}

/* WHR (Waist-to-Hip Ratio) interpretation colors */
.whr-low {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.whr-moderate {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.whr-high {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.whr-unknown {
  background: rgba(128, 128, 128, 0.15);
  color: #9ca3af;
}

/* GSR (Grip Strength Ratio) interpretation colors */
.gsr-good {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.gsr-moderate {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.gsr-low {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.gsr-unknown {
  background: rgba(128, 128, 128, 0.15);
  color: #9ca3af;
}

/* Trail Making interpretation colors */
.trail-normal {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.trail-mild {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.trail-significant {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.trail-unknown {
  background: rgba(128, 128, 128, 0.15);
  color: #9ca3af;
}

/* STS (Sit-to-Stand Ratio) interpretation colors */
.sts-good {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.sts-mild {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.sts-significant {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.sts-unknown {
  background: rgba(128, 128, 128, 0.15);
  color: #9ca3af;
}

/* Core Composite interpretation colors */
.core-excellent {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.core-good {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.core-fair {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.core-poor {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.core-unknown {
  background: rgba(128, 128, 128, 0.15);
  color: #9ca3af;
}

/* Jump Power interpretation colors */
.power-excellent {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.power-good {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.power-fair {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.power-low {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.power-unknown {
  background: rgba(128, 128, 128, 0.15);
  color: #9ca3af;
}

/* Asymmetry Composite Score interpretation colors */
.asymmetry-low {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.asymmetry-moderate {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.asymmetry-high {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.asymmetry-unknown {
  background: rgba(128, 128, 128, 0.15);
  color: #9ca3af;
}

/* Strength-to-Weight Ratio interpretation colors */
.strength-ratio-excellent {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.strength-ratio-good {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.strength-ratio-fair {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.strength-ratio-low {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.strength-ratio-unknown {
  background: rgba(128, 128, 128, 0.15);
  color: #9ca3af;
}

/* Balance Confidence to Performance Ratio interpretation colors */
.bcp-accurate {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.bcp-overconfident {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.bcp-underconfident {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.bcp-unknown {
  background: rgba(128, 128, 128, 0.15);
  color: #9ca3af;
}

/* Generic derived metric colors (fallback) */
.derived-normal, .derived-good, .derived-excellent {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.derived-moderate, .derived-mild, .derived-fair {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.derived-elevated, .derived-significant, .derived-high, .derived-low, .derived-poor {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.derived-unknown {
  background: rgba(128, 128, 128, 0.15);
  color: #9ca3af;
}

/* Derived metric test item styling */
.test-item-derived {
  border-left: 3px solid var(--cognition);
  background: rgba(236, 72, 153, 0.05);
}

.test-item-weaker {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.15rem 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  margin-left: 0.5rem;
}

.test-list-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* Clickable pillar cards */
.pillar-card.clickable {
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.pillar-card.clickable:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.2);
}

/* Mobile Responsive - Pillar Modal */
@media (max-width: 768px) {
  .modal-wide {
    max-width: 95vw;
    width: 95vw;
  }

  .pillar-modal-header {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .pillar-modal-icon {
    font-size: 2.5rem;
  }

  .pillar-modal-score {
    font-size: 2.5rem;
    padding: 0.75rem 1.5rem;
  }

  .test-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    /* Ensure touch-friendly tap area */
    min-height: 44px;
  }

  .test-item-left,
  .test-item-right {
    width: 100%;
  }

  .test-item-right {
    justify-content: space-between;
  }

  .test-item-value {
    font-size: 0.9rem;
  }

  .test-item-score {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
  }

  /* Increase test item touch target */
  .test-item-clickable {
    padding: 1.25rem;
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 480px) {
  .pillar-modal-header {
    padding-bottom: 1rem;
  }

  .pillar-modal-title-group h2 {
    font-size: 1.5rem;
  }

  .pillar-modal-subtitle {
    font-size: 0.85rem;
  }

  .test-item-name {
    font-size: 0.9rem;
  }
}

/* =========================================================================
   TEST DETAIL MODAL (Level 3)
   ========================================================================= */

.test-modal-header {
  text-align: center;
  margin-bottom: 2rem;
}

.test-modal-header h2 {
  margin: 0 0 0.5rem 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.test-modal-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Your Score Card */
.test-modal-your-score {
  display: flex;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.your-score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 3rem;
  background: linear-gradient(135deg, rgba(212, 168, 75, 0.15), rgba(61, 122, 77, 0.15));
  border: 2px solid rgba(212, 168, 75, 0.3);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.your-score-card .label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.your-score-card .value {
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent-gold);
  line-height: 1;
}

.your-score-card .percentile {
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 600;
}

.your-score-card .interpretation {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Bell Curve Visualization */
.test-modal-viz {
  margin-bottom: 2.5rem;
}

.test-modal-viz h3,
.test-modal-norms h3,
.test-modal-research h3 {
  margin: 0 0 1.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

#bell-curve-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 700px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  padding: 1rem;
}

/* Normative Data Table */
.test-modal-norms {
  margin-bottom: 2.5rem;
}

/* Table wrapper for horizontal scroll on mobile */
.norms-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  margin-bottom: 1rem;
  position: relative;
}

/* Scroll hint shadow for tables */
.norms-table-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 30px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.2));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
  .norms-table-wrapper::after {
    opacity: 1;
  }
}

.norms-table {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  overflow: hidden;
}

.norms-table thead {
  background: rgba(212, 168, 75, 0.15);
}

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

.norms-table th {
  font-weight: 600;
  color: var(--accent-gold);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.norms-table td {
  color: var(--text-primary);
  font-size: 0.95rem;
}

.norms-table tr:last-child td {
  border-bottom: none;
}

.norms-table tr.user-row {
  background: rgba(212, 168, 75, 0.1);
  font-weight: 600;
}

.user-score-highlight {
  text-align: center;
  padding: 1rem;
  background: rgba(212, 168, 75, 0.08);
  border-radius: 8px;
  margin: 1rem auto 0.5rem auto;
  max-width: 600px;
  color: var(--text-primary);
}

.user-score-highlight strong {
  color: var(--accent-gold);
}

.norms-info {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* Research Section */
.test-modal-research {
  margin-bottom: 2.5rem;
}

.test-modal-research p {
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.test-modal-research .research-link {
  color: var(--accent-gold);
  text-decoration: underline;
  transition: color 0.2s ease;
}

.test-modal-research .research-link:hover {
  color: #E5C068;
}

.test-modal-research .external-link-icon {
  color: var(--accent-gold);
  font-size: 0.85em;
  margin-left: 0.25rem;
}

/* Confidence Rating Display */
.confidence-rating {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  margin-bottom: 1rem;
  border-left: 3px solid var(--accent-gold);
}

.confidence-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.confidence-stars {
  font-size: 1.1rem;
  letter-spacing: 2px;
}

.confidence-star.filled {
  color: inherit;
}

.confidence-star.empty {
  opacity: 0.3;
}

.confidence-text {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.confidence-sample {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.research-text {
  line-height: 1.6;
}

/* Confidence Sources Display */
.confidence-sources {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
}

.sources-label {
  color: var(--text-muted);
}

.source-item {
  color: var(--accent-gold);
}

.source-separator {
  color: var(--text-muted);
}

/* Clinical Cutoffs Section */
.test-modal-clinical {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.test-modal-clinical h3 {
  color: var(--text-primary);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.cutoffs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cutoff-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
}

.cutoff-normal {
  border-left: 3px solid #22c55e;
}

.cutoff-warning {
  border-left: 3px solid #eab308;
  background: rgba(234, 179, 8, 0.1);
}

.cutoff-danger {
  border-left: 3px solid #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.cutoff-icon {
  font-size: 1.2rem;
  min-width: 1.5rem;
}

.cutoff-label {
  color: var(--text-muted);
  flex: 1;
}

.cutoff-value {
  font-weight: 600;
  color: var(--text-primary);
}

.cutoff-your-value {
  color: var(--accent-gold);
  font-size: 0.9rem;
}

.cutoff-note {
  font-style: italic;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  border-left: 3px solid var(--accent-gold);
}

.cutoff-note .note-icon {
  margin-right: 0.5rem;
}

.no-cutoffs {
  color: var(--text-muted);
  font-style: italic;
}

/* Test Instructions Section */
.test-modal-instructions {
  margin-bottom: 2rem;
}

.test-modal-instructions h3 {
  margin: 0 0 1.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

#test-instructions-content {
  max-width: 800px;
  margin: 0 auto;
}

.instructions-section {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.instructions-section h4 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-gold);
}

.instructions-steps {
  margin: 0;
  padding-left: 1.5rem;
  color: var(--text-primary);
}

.instructions-steps li {
  margin-bottom: 0.75rem;
  line-height: 1.6;
  padding-left: 0.5rem;
}

.instructions-steps li:last-child {
  margin-bottom: 0;
}

.instructions-equipment,
.instructions-safety {
  margin: 0;
  color: var(--text-primary);
  line-height: 1.6;
}

.safety-section {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
}

.safety-section h4 {
  color: #EF4444;
}

.instructions-placeholder,
.video-placeholder {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  font-style: italic;
}

.video-placeholder {
  margin-top: 1.5rem;
  background: rgba(212, 168, 75, 0.08);
  border: 1px solid rgba(212, 168, 75, 0.2);
}

.video-placeholder a {
  color: var(--accent-gold);
  text-decoration: underline;
}

/* Video Container */
.test-video-container {
  margin-top: 2rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.test-video-container h4 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-gold);
  text-align: center;
}

.test-video-container iframe {
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Mobile Responsive - Test Modal */
@media (max-width: 768px) {
  .test-modal-header h2 {
    font-size: 1.5rem;
  }

  .your-score-card {
    padding: 1.5rem 2rem;
  }

  .your-score-card .value {
    font-size: 2.5rem;
  }

  .your-score-card .percentile {
    font-size: 1rem;
  }

  #bell-curve-canvas {
    padding: 0.5rem;
    max-height: 250px;
  }

  .norms-table-wrapper {
    overflow-x: auto;
    margin: 0 -1rem; /* Bleed to modal edges on mobile */
    padding: 0 1rem;
  }

  .norms-table {
    min-width: 400px; /* Prevent squishing */
  }

  .norms-table th,
  .norms-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
  }

  .norms-table th {
    font-size: 0.8rem;
  }

  .instructions-section {
    padding: 1rem;
  }

  .instructions-steps {
    padding-left: 1.25rem;
  }

  .instructions-steps li {
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
  }

  .test-video-container iframe {
    height: 250px;
  }
}

@media (max-width: 480px) {
  .test-modal-header h2 {
    font-size: 1.25rem;
  }

  .your-score-card {
    padding: 1rem 1.5rem;
  }

  .your-score-card .value {
    font-size: 2rem;
  }

  .norms-table {
    font-size: 0.8rem;
  }

  .norms-table th,
  .norms-table td {
    padding: 0.6rem 0.4rem;
  }

  .instructions-section {
    padding: 0.75rem;
  }

  .instructions-section h4 {
    font-size: 1rem;
  }

  .instructions-steps {
    padding-left: 1rem;
  }

  .instructions-steps li {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
  }

  .test-video-container iframe {
    height: 200px;
  }
}

/* =========================================================================
   TRACKING DETAIL MODAL STYLES (Phase 3)
   ========================================================================= */

/* Tracking modal header */
.tracking-modal-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tracking-modal-header h2 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--metric-color, var(--accent-gold));
}

.tracking-modal-header p {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

/* Your value card */
.tracking-modal-your-value {
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
}

.tracking-modal-your-value .your-value-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 3rem;
  background: linear-gradient(135deg, rgba(212, 168, 75, 0.15), rgba(61, 122, 77, 0.15));
  border: 2px solid rgba(212, 168, 75, 0.3);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  min-width: 300px;
}

.tracking-modal-your-value .label {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.tracking-modal-your-value .value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--metric-color, var(--accent-gold));
  line-height: 1;
}

.tracking-modal-your-value .interpretation {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  font-style: italic;
  margin-top: 0.5rem;
}

/* Clinical ranges section */
.tracking-modal-ranges {
  margin-bottom: 2rem;
}

.tracking-modal-ranges h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: rgba(255, 255, 255, 0.9);
}

.clinical-ranges-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.range-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.range-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.range-item.user-in-range {
  background: rgba(212, 168, 75, 0.1);
  border: 1px solid rgba(212, 168, 75, 0.3);
  box-shadow: 0 2px 8px rgba(212, 168, 75, 0.2);
}

.range-bar {
  width: 8px;
  height: 40px;
  border-radius: 4px;
  flex-shrink: 0;
}

.range-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.range-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.range-values {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  font-family: 'Courier New', monospace;
}

.user-marker {
  font-size: 0.875rem;
  color: var(--accent-gold);
  font-weight: 700;
  margin-left: auto;
  animation: pulse 2s ease-in-out infinite;
}

/* Research section */
.tracking-modal-research {
  margin-bottom: 1rem;
}

.tracking-modal-research h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: rgba(255, 255, 255, 0.9);
}

.tracking-modal-research p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
}

.tracking-modal-research .research-link {
  color: var(--accent-gold);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
  border-bottom: 1px solid transparent;
}

.tracking-modal-research .research-link:hover {
  border-bottom-color: var(--accent-gold);
}

/* Make tracking items clickable */
.tracking-item-clickable {
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  margin: 0 -0.75rem;
  /* Touch-friendly minimum size */
  min-height: 44px;
  display: flex;
  align-items: center;
}

.tracking-item-clickable:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(4px);
}

.tracking-item-clickable:active {
  transform: translateX(4px) scale(0.98);
}

/* Touch device specific - no hover effect, better tap feedback */
@media (hover: none) and (pointer: coarse) {
  .tracking-item-clickable:hover {
    transform: none;
  }

  .tracking-item-clickable:active {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(0.98);
  }

  .test-item-clickable:hover {
    transform: none;
  }

  .test-item-clickable:active {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(0.98);
  }

  .pillar-card.clickable:hover {
    transform: none;
  }

  .pillar-card.clickable:active {
    transform: scale(0.98);
  }
}

/* Mobile responsiveness for tracking modal */
@media (max-width: 768px) {
  .tracking-modal-header h2 {
    font-size: 1.5rem;
  }

  .tracking-modal-header p {
    font-size: 0.9rem;
  }

  .tracking-modal-your-value .your-value-card {
    padding: 1.5rem 2rem;
    min-width: auto;
    width: 100%;
  }

  .tracking-modal-your-value .value {
    font-size: 2rem;
  }

  .tracking-modal-your-value .interpretation {
    font-size: 0.9rem;
  }

  .tracking-modal-ranges h3,
  .tracking-modal-research h3 {
    font-size: 1.1rem;
  }

  .range-item {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
  }

  .range-bar {
    width: 8px;
    height: 40px;
    flex-shrink: 0;
  }

  .range-label {
    font-size: 0.9rem;
  }

  .range-values {
    font-size: 0.8rem;
  }

  .user-marker {
    margin-left: auto;
    font-size: 0.8rem;
  }

  .tracking-modal-research p {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .tracking-modal-header h2 {
    font-size: 1.25rem;
  }

  .tracking-modal-header p {
    font-size: 0.85rem;
  }

  .tracking-modal-your-value .your-value-card {
    padding: 1.25rem 1.5rem;
  }

  .tracking-modal-your-value .value {
    font-size: 1.75rem;
  }

  .tracking-modal-your-value .label {
    font-size: 0.75rem;
  }

  .tracking-modal-your-value .interpretation {
    font-size: 0.85rem;
  }

  .tracking-modal-ranges h3,
  .tracking-modal-research h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }

  .range-item {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .range-label {
    font-size: 0.85rem;
  }

  .range-values {
    font-size: 0.75rem;
  }

  .user-marker {
    font-size: 0.75rem;
  }

  .tracking-modal-research p {
    font-size: 0.85rem;
    line-height: 1.5;
  }
}

/* =========================================================================
   UPGRADE MODAL
   ========================================================================= */
.upgrade-modal-content {
  text-align: center;
  padding: 1rem;
}

.upgrade-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
}

.upgrade-modal-content h2 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--accent-gold), #ffd700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.upgrade-reason {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.upgrade-features {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.upgrade-features h4 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.upgrade-features ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.upgrade-features li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.upgrade-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent-gold);
  font-weight: bold;
}

.upgrade-pricing {
  margin-bottom: 1.5rem;
}

.pricing-options {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.pricing-option {
  background: var(--bg-card);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 110px;
  position: relative;
}

.pricing-option:hover {
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-2px);
}

.pricing-option.selected {
  border-color: var(--accent-gold);
  background: rgba(212, 168, 75, 0.1);
}

.pricing-option.recommended {
  border-color: var(--accent-gold);
}

.pricing-option .badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-gold);
  color: #1a1a1a;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.pricing-option .plan-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.pricing-option .price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pricing-option .price span {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.pricing-option .savings {
  font-size: 0.75rem;
  color: var(--accent-gold);
  margin-top: 0.25rem;
}

.upgrade-pricing .price {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.upgrade-pricing .price span {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.annual-option {
  color: var(--accent-gold);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.btn-upgrade {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-gold), #ffd700) !important;
  color: #1a1a1a !important;
  font-weight: 600;
  font-size: 1.1rem;
  padding: 1rem 2rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 0.75rem;
}

.btn-upgrade:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(212, 168, 75, 0.4);
}

.btn-upgrade-later {
  width: 100%;
  background: transparent !important;
  color: var(--text-muted) !important;
  font-size: 0.9rem;
  padding: 0.75rem;
  border: 1px solid rgba(255,255,255,0.1) !important;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-upgrade-later:hover {
  color: var(--text-primary) !important;
  border-color: rgba(255,255,255,0.3) !important;
}

/* Inline upgrade button (used in trend section) */
.btn-upgrade-inline {
  background: linear-gradient(135deg, var(--accent-gold), #ffd700);
  color: #1a1a1a;
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
}

.btn-upgrade-inline:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(212, 168, 75, 0.3);
}

/* =========================================================================
   TREND CHART SECTION
   ========================================================================= */
.test-modal-trend {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.test-modal-trend h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

#trend-chart-container {
  position: relative;
  min-height: 280px;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 1rem;
}

#trend-chart-canvas {
  width: 100%;
  max-width: 700px;
  display: block;
  margin: 0 auto;
}

/* Trend upgrade prompt (free users) */
.trend-upgrade-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  text-align: center;
  padding: 2rem;
}

.trend-upgrade-prompt .lock-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.7;
}

.trend-upgrade-prompt p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

/* Trend not enough data message */
.trend-not-enough {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  text-align: center;
  padding: 2rem;
}

.trend-not-enough .info-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.trend-not-enough p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Trend chart percentile zone colors */
.trend-zone-excellent { background: rgba(34, 197, 94, 0.15); }
.trend-zone-good { background: rgba(234, 179, 8, 0.15); }
.trend-zone-fair { background: rgba(249, 115, 22, 0.15); }
.trend-zone-poor { background: rgba(239, 68, 68, 0.15); }

@media (max-width: 768px) {
  .upgrade-modal-content {
    padding: 0.5rem;
  }

  .upgrade-icon {
    font-size: 2.5rem;
  }

  .upgrade-modal-content h2 {
    font-size: 1.5rem;
  }

  .upgrade-pricing .price {
    font-size: 2rem;
  }

  #trend-chart-container {
    padding: 0.5rem;
  }

  .trend-upgrade-prompt,
  .trend-not-enough {
    min-height: 150px;
    padding: 1rem;
  }
}

/* =========================================================================
   RESOURCE LINKS SECTION (Test Instructions Modal)
   ========================================================================= */

.resources-section {
  margin: 1.5rem 0;
  padding: 0;
}

.resources-section h4 {
  color: var(--gold);
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.resource-link {
  display: block;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  text-decoration: none;
  transition: all 0.2s ease;
  color: inherit;
}

.resource-link:last-child {
  margin-bottom: 0;
}

.resource-link:hover {
  transform: translateX(4px);
}

.resource-link:hover .resource-link-action {
  text-decoration: underline;
}

.resource-link-title {
  color: var(--text-primary) !important;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.resource-link-description {
  color: var(--text-secondary) !important;
  font-size: 0.85rem;
  line-height: 1.4;
}

.resource-link-action {
  color: var(--gold) !important;
  font-size: 0.85rem;
  margin-top: 0.25rem;
  font-weight: 500;
}

/* =========================================================================
   COURSE PROGRESS SECTION (Premium Feature)
   ========================================================================= */

/* Badge styles for premium indicators */
.badge-gold {
  background: linear-gradient(135deg, var(--gold), #b8860b);
  color: #000;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Course Section Header */
.course-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.course-header h3 {
  margin: 0;
  color: var(--text-primary);
}

/* Overall Progress Bar */
.course-overall-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 200px;
}

.progress-bar-container {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  min-width: 150px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #d4a84b);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-text {
  font-size: 0.9rem;
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
}

/* Course Modules Grid */
.course-modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

/* Module Cards */
.course-module-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.course-module-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.course-module-card.not-started {
  opacity: 0.8;
}

.course-module-card.in-progress {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.05);
}

.course-module-card.complete {
  border-color: #3D7A4D;
  background: rgba(61, 122, 77, 0.08);
}

.module-status-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.course-module-card.not-started .module-status-icon {
  color: var(--text-secondary);
}

.course-module-card.in-progress .module-status-icon {
  color: var(--gold);
}

.course-module-card.complete .module-status-icon {
  color: #3D7A4D;
}

.module-week {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.module-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.module-progress {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Course Upgrade Prompt */
.course-upgrade-prompt {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(217, 119, 6, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
}

.course-upgrade-prompt .upgrade-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.course-upgrade-prompt h3 {
  margin: 0 0 0.5rem 0;
  color: var(--gold);
}

.course-upgrade-prompt p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* Secondary button - black box with white text */
.btn-secondary {
  background: #000;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

.btn-secondary:hover {
  background: #1a1a1a;
  border-color: rgba(255, 255, 255, 0.5);
}

/* Gold button - black box with white text */
.btn-gold {
  background: #000;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

.btn-gold:hover {
  background: #1a1a1a;
  border-color: var(--gold);
}

/* =========================================================================
   COURSE MODULE MODAL
   ========================================================================= */

.course-modal-content {
  padding: 1.5rem;
}

.course-modal-header {
  margin-bottom: 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.course-week-badge {
  display: inline-block;
  background: #000;
  color: #fff;
  padding: 1rem 2.5rem;
  border-radius: 30px;
  font-size: 2rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-shadow: none;
}

.course-modal-header h2 {
  margin: 0.75rem 0 0 0;
  font-size: 1.5rem;
  color: var(--text-primary);
  font-weight: 600;
}

.course-doc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  margin-bottom: 1.5rem;
  text-decoration: none;
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold);
}

.course-doc-btn:hover {
  background: rgba(245, 158, 11, 0.1);
  color: var(--gold);
}

.course-tasks-section h4 {
  color: var(--text-primary);
  margin: 0 0 1rem 0;
  font-size: 1rem;
}

.course-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Task Item Checkbox */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.task-item:hover {
  border-color: var(--gold);
}

.task-item.completed {
  background: rgba(61, 122, 77, 0.08);
  border-color: rgba(61, 122, 77, 0.3);
}

.task-item input[type="checkbox"] {
  display: none;
}

.task-checkbox {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: 2px solid var(--gold);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-top: 1px;
  background: rgba(245, 158, 11, 0.1);
}

.task-checkbox::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: transparent;
  transition: all 0.2s ease;
}

.task-item:hover .task-checkbox {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.2);
}

.task-item.completed .task-checkbox {
  background: #3D7A4D;
  border-color: #3D7A4D;
}

.task-item.completed .task-checkbox::before {
  display: none;
}

.task-item.completed .task-checkbox::after {
  content: '✓';
  color: white;
  font-size: 1rem;
  font-weight: bold;
}

.task-text {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.task-item.completed .task-text {
  color: var(--text-primary);
}

/* Task item with progress indicator */
.task-item .task-percentage {
  background: var(--gold);
  color: #000;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  margin-left: 0.5rem;
}

.task-item .task-percentage.partial {
  background: rgba(245, 158, 11, 0.3);
  color: var(--gold);
}

/* =========================================================================
   TASK ENTRY MODAL
   ========================================================================= */

.task-entry-content {
  padding: 1.5rem;
}

.task-entry-content h3 {
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
}

.task-entry-instruction {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.task-entry-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.task-progress-bar {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}

.task-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #d4a84b);
  border-radius: 5px;
  transition: width 0.3s ease;
  width: 0%;
}

.task-progress-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold);
  white-space: nowrap;
}

.task-entry-list {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-entry-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.task-entry-number {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.task-entry-row.filled .task-entry-number {
  background: var(--gold);
  color: #000;
}

.task-entry-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.task-entry-input:focus {
  outline: none;
  border-color: var(--gold);
}

.task-entry-input::placeholder {
  color: var(--text-muted);
}

.task-entry-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.task-entry-actions .btn {
  padding: 0.75rem 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
  .course-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .course-overall-progress {
    width: 100%;
  }

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

  .course-modal-content {
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  .course-modules-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   BACKCASTING GRID MODAL
   ========================================================================= */

.modal-wide {
  max-width: 900px;
  width: 95%;
}

.backcasting-content {
  padding: 1rem;
}

.backcasting-content h3 {
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.backcasting-instruction {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.backcasting-activity-select {
  margin-bottom: 1.5rem;
}

.backcasting-activity-select label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.backcasting-activity-select select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
}

.backcasting-activity-select select:focus {
  outline: none;
  border-color: var(--gold);
}

.backcasting-grid-container {
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.backcasting-grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
}

.backcasting-grid th,
.backcasting-grid td {
  padding: 0.75rem;
  text-align: center;
  border: 1px solid var(--border);
}

.backcasting-grid th {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.backcasting-grid .age-label {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.backcasting-grid .grid-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 0.85rem;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.backcasting-grid .grid-input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.1);
}

.backcasting-grid .grid-input::placeholder {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.backcasting-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* Preset Browser Mode Toggle */
.backcasting-mode-toggle {
  margin-bottom: 1.5rem;
}

.backcasting-mode-toggle .mode-label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.mode-buttons {
  display: flex;
  gap: 0.5rem;
}

.mode-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  border-color: var(--gold);
  color: var(--text-primary);
}

.mode-btn.active {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold);
}

/* Preset Browser */
.preset-browser {
  margin-bottom: 1.5rem;
}

.preset-search-row {
  margin-bottom: 1rem;
}

.preset-search {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 1rem;
}

.preset-search:focus {
  outline: none;
  border-color: var(--gold);
}

.preset-search::placeholder {
  color: var(--text-muted);
}

.preset-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.preset-cat-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-cat-btn:hover {
  border-color: var(--gold);
  color: var(--text-primary);
}

.preset-cat-btn.active {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--bg-dark);
}

.preset-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
}

.preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s ease;
}

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

.preset-item:hover {
  background: rgba(212, 175, 55, 0.1);
}

.preset-item-info {
  flex: 1;
}

.preset-item-name {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.preset-item-category {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.preset-item-mets {
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  background: rgba(212, 175, 55, 0.2);
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  margin-left: 1rem;
}

.preset-list-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

/* Custom Activity Entry */
.custom-activity-entry {
  margin-bottom: 1.5rem;
}

.custom-activity-name {
  margin-top: 1rem;
}

.custom-activity-name label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.custom-activity-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 1rem;
}

.custom-activity-input:focus {
  outline: none;
  border-color: var(--gold);
}

/* Selected Activity Display */
.selected-activity-display {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 2px solid var(--gold);
  border-radius: 8px;
  background: rgba(212, 175, 55, 0.1);
}

.selected-activity-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.selected-label {
  font-weight: 600;
  color: var(--text-muted);
}

.selected-name {
  font-weight: 700;
  color: var(--gold);
  font-size: 1.1rem;
}

.selected-mets {
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  background: rgba(212, 175, 55, 0.2);
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-change-activity {
  margin-left: auto;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: transparent;
  color: var(--gold);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-change-activity:hover {
  background: var(--gold);
  color: var(--bg-dark);
}

/* Responsive */
@media (max-width: 768px) {
  .backcasting-grid th,
  .backcasting-grid td {
    padding: 0.5rem 0.25rem;
    font-size: 0.8rem;
  }

  .backcasting-grid .grid-input {
    padding: 0.4rem;
    font-size: 0.75rem;
  }
}

/* =========================================================================
   NAV LINK STYLES
   ========================================================================= */
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.1);
}

/* =========================================================================
   EXERCISE LIBRARY PROMO
   ========================================================================= */
.exercise-library-promo {
  margin-bottom: 2rem;
}

.promo-card {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
}

.promo-icon {
  font-size: 3rem;
  flex-shrink: 0;
}

.promo-content h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.promo-content p {
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.5;
}

.promo-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.promo-links .btn {
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  .promo-card {
    flex-direction: column;
    text-align: center;
  }

  .promo-links {
    justify-content: center;
  }
}
