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

:root {
  --bg: #07080f;
  --surface: #0f1020;
  --surface2: #161828;
  --border: rgba(255,255,255,0.07);
  --primary: #6366f1;
  --primary-light: #818cf8;
  --accent: #06b6d4;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text: #e2e8f0;
  --muted: #64748b;
  --font: 'Inter', sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
}

/* ===== LIGHT THEME ===== */
:root.light-theme {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --border: rgba(0, 0, 0, 0.08);
  --primary: #4f46e5;
  --primary-light: #6366f1;
  --accent: #0891b2;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --text: #0f172a;
  --muted: #475569;
}

/* ===== THEME TOGGLE BUTTON ===== */
.btn-theme-toggle {
  background: var(--surface2) !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  border: 1px solid var(--border) !important;
}
.btn-theme-toggle:hover {
  transform: scale(1.08);
  border-color: var(--primary) !important;
  color: var(--primary-light) !important;
}

html { scroll-behavior: smooth; }

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

/* ===== NAV ===== */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 40px;
  background: rgba(7,8,15,0.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}

.lang-bar { display: flex; gap: 6px; flex-wrap: wrap; }

.lang-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: var(--font);
  font-weight: 500;
  transition: all 0.2s;
}

.lang-btn:hover, .lang-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border-color: transparent;
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 64px 20px 36px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -60px; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 300px;
  background: radial-gradient(ellipse at center, rgba(99,102,241,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
}

.arrow-down {
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

@media (max-width: 900px) {
  .nav-links { display: none !important; }
}

.hero h1 span {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto;
}

/* ===== MAIN GRID ===== */
.app-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 24px;
}

@media (max-width: 768px) {
  .app-grid { grid-template-columns: 1fr; }
  .nav { padding: 14px 20px; }
}

/* ===== PANEL ===== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--surface2);
}

.panel-icon { font-size: 1.1rem; }

/* ===== CAMERA ===== */
.camera-box {
  position: relative;
  background: #000;
  aspect-ratio: 4/3;
  overflow: hidden;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  gap: 12px;
}

.camera-placeholder.hidden { display: none; }

.placeholder-icon { font-size: 3rem; opacity: 0.4; }
.camera-placeholder p { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 0 20px; }

.camera-controls {
  display: flex;
  gap: 10px;
  padding: 16px;
  flex-wrap: wrap;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  justify-content: center;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}
.btn-primary:not(:disabled):hover { opacity: 0.88; transform: translateY(-1px); }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:not(:disabled):hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:not(:disabled):hover { filter: brightness(1.1); }

/* ===== LIVE TOGGLE ===== */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
  user-select: none;
}

.toggle-row input { display: none; }

.toggle-slider {
  width: 40px;
  height: 22px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 11px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: var(--muted);
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: all 0.2s;
}

.toggle-row input:checked ~ .toggle-slider { background: var(--primary); border-color: var(--primary); }
.toggle-row input:checked ~ .toggle-slider::after { left: 20px; background: #fff; }

/* ===== SENSOR DASHBOARD ===== */
.sensor-dashboard {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 16px 22px;
}

.sensor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 0.9rem;
}

.sensor-data-grid {
  display: flex;
  gap: 12px;
}

.sensor-data-item {
  flex: 1;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.sensor-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.sensor-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

.sensor-value .unit {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 2px;
}

/* ===== RESULTS PANEL ===== */
.results-panel { min-height: 480px; }

.idle-state, .loading-state, .error-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 24px;
}

.idle-icon { font-size: 3rem; opacity: 0.3; }
.idle-state p { color: var(--muted); font-size: 0.9rem; text-align: center; }

.spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state p { color: var(--muted); font-size: 0.9rem; }

.error-icon { font-size: 2.5rem; }
.error-state p { color: var(--danger); font-size: 0.9rem; text-align: center; }

/* ===== RESULT ITEMS ===== */
.results-list {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color 0.3s;
}

.result-item.good  { border-color: rgba(34,197,94,0.4); }
.result-item.warn  { border-color: rgba(245,158,11,0.4); }
.result-item.bad   { border-color: rgba(239,68,68,0.4); }

.result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}

.result-emoji { font-size: 1rem; }

.result-bar-wrap {
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  height: 6px;
  margin-bottom: 8px;
  overflow: hidden;
}

.result-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-bar.good  { background: linear-gradient(90deg, #22c55e, #4ade80); }
.result-bar.warn  { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.result-bar.bad   { background: linear-gradient(90deg, #ef4444, #f87171); }

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

.result-angle {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.result-feedback {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: right;
}

/* ===== ADVANCED CALIBRATION METRICS SIDEBAR ===== */
.metrics-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.m-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.2s ease, border-color 0.3s;
}

.m-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.3);
}

.m-card label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.m-val {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 2px;
  text-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
}

/* Light theme overrides */
.light-theme .m-card {
  background: var(--surface);
  border-color: var(--border);
}

.light-theme .m-card label {
  color: var(--muted);
}

.light-theme .m-val {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}


/* ===== OVERALL SCORE ===== */
.overall-score {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(6,182,212,0.08));
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-top: 4px;
  font-weight: 600;
}

.score-value {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ===== FEATURES ===== */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  max-width: 1100px;
  margin: 20px auto 60px;
  padding: 0 24px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: all 0.3s;
}

.feature-card:hover {
  border-color: rgba(99,102,241,0.3);
  background: rgba(99,102,241,0.05);
  transform: translateY(-3px);
}

.feature-icon { font-size: 1.8rem; margin-bottom: 12px; }
.feature-card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 6px; }
.feature-card p { color: var(--muted); font-size: 0.85rem; line-height: 1.5; }

/* ===== PREMIUM BRAND FOOTER ===== */
.main-footer {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-top: 1px solid var(--border);
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font);
  padding: 60px 24px 40px;
  position: relative;
  overflow: hidden;
  margin-top: 40px;
}

/* Subtle glow highlight matching the accent color of the page */
.main-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 250px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #06b6d4, transparent);
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 30px;
}

.footer-link {
  color: #ffffff;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}

.footer-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 0;
  background-color: #06b6d4;
  transition: width 0.2s ease;
}

.footer-link:hover {
  color: #06b6d4;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.footer-link:hover::after {
  width: 100%;
}

.footer-divider {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 10px 0;
}

.footer-centered-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  text-align: center;
}

.footer-contact-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.95rem;
}

.footer-contact-centered a {
  color: #06b6d4;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-contact-centered a:hover {
  color: #ffffff;
}

.footer-copyright-centered {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
}

.footer-location-centered {
  margin-top: 4px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

/* ===== PAYWALL ===== */
.paywall-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.paywall-box {
  background: rgba(25, 30, 45, 0.95);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  animation: fadeIn 0.3s ease-out;
}
.paywall-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.paywall-box h2 {
  font-size: 24px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.paywall-box p {
  color: #a0aec0;
  margin-bottom: 24px;
  font-size: 15px;
  line-height: 1.5;
}
.checkout-btn {
  width: 100%;
  background: linear-gradient(135deg, #00C9FF 0%, #92FE9D 100%);
  color: #000;
  font-weight: 700;
  font-size: 16px;
  padding: 14px;
}
.checkout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 201, 255, 0.3);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(5px);
  z-index: 9999; display: flex; align-items: center; justify-content: center;
}
.modal-content {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 30px; max-width: 400px; width: 90%;
  text-align: center; color: var(--text);
}

/* Info Section Styling */
.info-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.info-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(99,102,241,0.15);
}

/* PRO DASHBOARD GRID */
.main-dashboard-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 30px;
  max-width: 1300px;
  margin: 40px auto;
  padding: 0 30px;
}

.dashboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  height: 700px; /* Unified Height */
}

.card-header-pro {
  padding: 20px 25px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.02);
}

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

.header-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 10px #10b981;
}

.source-group {
  display: flex;
  background: var(--surface2);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.btn-source {
  background: none;
  border: none;
  color: var(--muted);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.btn-source.active {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: white;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.btn-ble-pro {
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.3);
  color: var(--primary-light);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ble-pro:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(99,102,241,0.4);
  transform: translateY(-1px);
}

.viewport-container {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
}

.viewport-container video, .viewport-container canvas, .viewport-container img {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  object-fit: contain;
}

.viewport-placeholder {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #1a1a2e 0%, #0a0a0f 100%);
  z-index: 5;
}

.p-icon { font-size: 4rem; margin-bottom: 20px; filter: grayscale(1); opacity: 0.3; }

.card-controls-pro {
  padding: 25px;
  background: rgba(255,255,255,0.01);
  border-top: 1px solid var(--border);
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 20px;
}

.select-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.select-wrapper label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.select-wrapper select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px;
  border-radius: 10px;
  outline: none;
}
.select-wrapper select option {
  background: var(--surface);
  color: var(--text);
}

.btn-secondary-pro {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  align-self: flex-end;
  height: 42px;
  transition: all 0.2s;
}

.btn-secondary-pro:hover {
  background: var(--border);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

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

.btn-primary-pro {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border: none;
  border-radius: 12px;
  color: white;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(99,102,241,0.3);
  transition: all 0.3s;
}

.btn-primary-pro:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 15px 30px rgba(99,102,241,0.4);
  filter: brightness(1.1);
}

.btn-primary-pro:active:not(:disabled) {
  transform: translateY(-1px);
}

.btn-primary-pro:disabled {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.8;
}

.telemetry-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}

.t-item {
  background: var(--surface);
  padding: 15px;
  text-align: center;
}

.t-item label {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.t-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: #6366f1;
}

.results-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 25px;
}

.results-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.brain-icon { font-size: 3rem; margin-bottom: 15px; opacity: 0.2; }

@media (max-width: 1000px) {
  .main-dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-card {
    height: auto;
    min-height: 500px;
  }
}

/* Global Utilities */
.hidden { display: none !important; }

/* LANGUAGE DROPDOWN (HAMBURGER STYLE) */
.lang-dropdown {
  position: relative;
  display: inline-block;
}

.lang-dropbtn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.lang-dropbtn:hover {
  background: var(--border);
  border-color: var(--primary);
}

.lang-options {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  min-width: 160px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.6);
  border: 1px solid var(--border);
  border-radius: 14px;
  z-index: 2000;
  overflow: hidden;
  animation: fadeIn 0.2s ease-out;
}

.lang-dropdown:hover .lang-options {
  display: block;
}

.lang-opt-btn {
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lang-opt-btn:hover {
  background: var(--surface2);
  color: var(--primary);
}

.lang-opt-btn.active {
  color: var(--primary);
  background: rgba(99,102,241,0.1);
}

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

#video-box {
  position: relative;
  overflow: hidden;
  background: #000;
}

#video-box.calibration-zoom {
  position: fixed !important;
  top: 0 !important; left: 0 !important; width: 100vw !important; height: 100vh !important;
  z-index: 9999 !important;
  background: #000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
#video-box.calibration-zoom video, #video-box.calibration-zoom canvas, #video-box.calibration-zoom img {
  width: 100% !important; height: 100% !important; object-fit: contain !important;
}

/* Lightbox Modal Animations and Responsive overrides */
@keyframes lightboxEntry {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 768px) {
  .lightbox-content {
    flex-direction: column !important;
    height: 90vh !important;
    overflow-y: auto !important;
  }
  .lightbox-content > div {
    flex: none !important;
    width: 100% !important;
  }
  .lightbox-content > div:first-child {
    height: 45vh !important;
    border-right: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  }
  .lightbox-content > div:last-child {
    padding: 20px !important;
  }
}

/* Glassmorphic AI Scan Tip Card styles */
.glass-info-card {
  background: rgba(99, 102, 241, 0.08);
  border: 1px dashed rgba(99, 102, 241, 0.3);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 10px;
  margin-bottom: 5px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.glass-info-card .tip-icon {
  font-size: 1.25rem;
  line-height: 1;
  color: #6366f1;
}

.glass-info-card .tip-content h4 {
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: #a5b4fc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.glass-info-card .tip-content p {
  font-size: 0.78rem;
  line-height: 1.45;
  margin: 0;
  color: var(--muted);
}

/* ===== CONTRAST & COLOR OVERRIDES (BULLETPROOF) ===== */
#cs-title,
#hw-stats-title {
  background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: var(--primary) !important;
}

#setup-guide h4,
#cs-r1-title,
#cs-r2-title,
#cs-r3-title,
#cs-r4-title,
#cs-r5-title {
  color: var(--primary) !important;
}

#hw-l-knee,
#hw-l-hip,
#hw-l-shoulder,
#config-modal h2 {
  color: var(--text) !important;
}

/* Premium Triathlon Aero Card styles */
.aero-tips-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(6, 182, 212, 0.15) 100%);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 12px;
  padding: 16px;
  margin-top: 14px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

.aero-tips-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 32px 0 rgba(6, 182, 212, 0.2);
  transform: translateY(-2px);
}

.light-theme .aero-tips-card {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(8, 145, 178, 0.08) 100%);
  border-color: rgba(79, 70, 229, 0.25);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
}

/* Split-Screen Multi-Photo Viewer Workspace Styles */
#multi-photo-viewer {
  transition: opacity 0.4s ease;
}

.multi-photo-slot {
  position: relative;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.multi-photo-slot:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 12px 30px rgba(0,0,0,0.6);
}

#btn-swap-slots:hover {
  transform: translate(-50%, -50%) scale(1.1) rotate(180deg);
  border-color: var(--primary-light);
  box-shadow: 0 10px 25px rgba(99,102,241,0.5);
  background: var(--primary);
}

#btn-swap-slots:active {
  transform: translate(-50%, -50%) scale(0.95) rotate(180deg);
}

/* Responsive side-by-side splitting */
@media (max-width: 768px) {
  #multi-photo-viewer {
    flex-direction: column !important;
    overflow-y: auto;
  }
  
  .multi-photo-slot {
    min-height: 200px;
    flex: 1 !important;
  }

  #btn-swap-slots {
    top: 50%;
    left: 90%;
    transform: translate(-50%, -50%);
  }

  #btn-swap-slots:hover {
    transform: translate(-50%, -50%) scale(1.1) rotate(180deg);
  }
  
  #btn-swap-slots:active {
    transform: translate(-50%, -50%) scale(0.95) rotate(180deg);
  }
}

/* Zoom Overlay Hover Transition for Right Side Analyzed Snapshots */
.right-photo-wrapper:hover .zoom-overlay {
  opacity: 1 !important;
}

/* ===== BRAND FOOTER & MODAL LIGHT-THEME ADAPTATION ===== */
:root.light-theme .main-footer {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text);
}
:root.light-theme .main-footer::before {
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
:root.light-theme .footer-link {
  color: var(--text);
}
:root.light-theme .footer-link:hover {
  color: var(--accent);
}
:root.light-theme .footer-divider {
  background: rgba(0, 0, 0, 0.08);
}
:root.light-theme .footer-copyright-centered {
  color: var(--muted);
}
:root.light-theme .footer-location-centered {
  color: var(--text);
}
:root.light-theme .footer-contact-centered span {
  color: var(--text);
}
:root.light-theme .footer-contact-centered a {
  color: var(--accent);
}
:root.light-theme .footer-contact-centered a:hover {
  color: var(--text);
}
:root.light-theme #btn-back-to-top {
  color: var(--accent) !important;
}

/* Modals Light Theme Glassmorphism Override */
:root.light-theme #about-modal,
:root.light-theme #info-modal {
  background: rgba(15, 23, 42, 0.45) !important;
}
:root.light-theme #about-modal > div,
:root.light-theme #info-modal > div {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  color: var(--text) !important;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.4) !important;
}
:root.light-theme #about-modal div,
:root.light-theme #info-modal div {
  color: var(--text) !important;
}
:root.light-theme #about-bio,
:root.light-theme #info-modal-body {
  color: #334155 !important;
}
:root.light-theme #about-modal button,
:root.light-theme #info-modal button {
  color: var(--text) !important;
}
:root.light-theme #btn-close-about,
:root.light-theme #btn-close-info {
  background: rgba(0,0,0,0.05) !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  color: var(--muted) !important;
}
:root.light-theme #btn-close-about:hover,
:root.light-theme #btn-close-info:hover {
  background: rgba(0,0,0,0.1) !important;
  color: var(--text) !important;
}
:root.light-theme #btn-about-close-action,
:root.light-theme #btn-info-close-action {
  color: #ffffff !important;
}

/* ===== NATIVE APP MOBILE STYLES ===== */
@media (max-width: 768px) {
  /* Apply native app interactions only on mobile devices */
  body {
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
  }

  /* Hide the hero section completely for an app-like feel */
  .hero {
    display: none !important;
  }
  
  /* Make the main workspace fill the screen without margins */
  .main-dashboard-grid {
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
  }
  
  /* Remove rounded corners and borders from the edges to feel like full-screen views */
  .dashboard-card {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    box-shadow: none !important;
    min-height: auto !important;
  }
  
  /* Compact Navigation */
  .nav {
    padding: 12px 16px !important;
  }
  
  .logo {
    font-size: 1.2rem !important;
  }
  
  /* Touch-friendly buttons */
  .btn, .btn-source {
    padding: 12px 16px !important;
    font-size: 0.95rem !important;
  }
  
  .btn-primary-pro {
    padding: 18px !important;
    font-size: 1.1rem !important;
  }
  
  /* Make camera fill available width cleanly */
  .viewport-container {
    aspect-ratio: 4/3;
    width: 100%;
    height: auto;
  }
}

/* Info Tooltip Styles */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  font-size: 10px;
  font-weight: bold;
  cursor: help;
  margin-left: 4px;
  position: relative;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.info-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e2d;
  color: #e2e8f0;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: normal;
  width: max-content;
  max-width: 200px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  font-weight: normal;
  line-height: 1.4;
}

.info-icon::before {
  content: '';
  position: absolute;
  bottom: 105%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: #1e1e2d transparent transparent transparent;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1000;
}

.info-icon:hover::after,
.info-icon:hover::before {
  opacity: 1;
  visibility: visible;
  bottom: 150%;
}

.info-icon:hover::before {
  bottom: calc(150% - 10px);
}

/* Disabled styling for toggles */
.disabled-toggle {
  opacity: 0.4;
  pointer-events: none;
}
