/* ==========================================================================
   CAP-LFFW • Paramotor Flight Companion - Design System
   Aesthetic: Aeronautical Modern Cockpit / Glassmorphism
   ========================================================================== */

:root {
  /* Color Palette - Dark Cockpit Mode (Default) */
  --bg-primary: #070b14;
  --bg-secondary: #0f172a;
  --bg-tertiary: #1e293b;
  --surface-glass: rgba(15, 23, 42, 0.78);
  --surface-card: rgba(30, 41, 59, 0.65);
  --surface-hover: rgba(51, 65, 85, 0.5);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(6, 182, 212, 0.4);
  
  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #070b14;
  
  /* Accent Colors (Aviation Standard) */
  --cyan-accent: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.25);
  --green-safe: #10b981;
  --green-glow: rgba(16, 185, 129, 0.25);
  --amber-warning: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.25);
  --red-danger: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.25);
  --blue-primary: #3b82f6;

  /* Fonts & Shadows */
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px var(--cyan-glow);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition-fast: 0.18s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Overrides */
body.theme-light {
  --bg-primary: #f1f5f9;
  --bg-secondary: #e2e8f0;
  --bg-tertiary: #cbd5e1;
  --surface-glass: rgba(255, 255, 255, 0.85);
  --surface-card: rgba(255, 255, 255, 0.92);
  --surface-hover: rgba(241, 245, 249, 0.9);
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-active: rgba(6, 182, 212, 0.6);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

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

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* App Container */
.app-container {
  max-width: 768px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 90px; /* Space for bottom nav */
}

/* Top App Header */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-active);
  box-shadow: var(--shadow-glow);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #38bdf8 0%, #06b6d4 50%, #f97316 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.65rem;
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan-accent);
  border: 1px solid var(--border-active);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  letter-spacing: 0.8px;
  font-weight: 700;
  -webkit-text-fill-color: var(--cyan-accent);
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.freq-pill {
  font-family: var(--font-mono);
  color: var(--amber-warning);
  font-weight: 600;
}

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

.btn-icon {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  color: var(--cyan-accent);
  border-color: var(--cyan-accent);
  transform: scale(1.05);
}

/* Tab Views Container */
.tab-content {
  display: none;
  padding: 16px;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.25s ease forwards;
}

.tab-content.active {
  display: flex;
}

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

/* Cards Design System */
.card {
  background: var(--surface-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

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

.card-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg {
  color: var(--cyan-accent);
}

/* Quick Stats Grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-box {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  margin-top: 4px;
}

.stat-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Time Slider for Weather */
.time-slider-card {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12) 0%, rgba(59, 130, 246, 0.05) 100%);
  border: 1px solid var(--border-active);
}

.time-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.time-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--cyan-accent);
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-btn {
  background: var(--surface-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.time-btn:active {
  transform: scale(0.92);
}

/* Wind Profile Graph */
.wind-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.wind-alt {
  width: 44px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.wind-bar-container {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.wind-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s ease, background-color 0.4s ease;
}

.wind-speed-val {
  width: 65px;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* METAR & NOTAM Section */
.metar-banner {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.metar-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green-safe);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--green-safe);
  box-shadow: 0 0 10px var(--green-safe);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Webcam Preview */
.webcam-container {
  position: relative;
  width: 100%;
  height: 220px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #000;
}

.webcam-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.webcam-img:hover {
  transform: scale(1.02);
}

.webcam-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.5px;
}

/* Checklist Items */
.checklist-category-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--cyan-accent);
  text-transform: uppercase;
  margin-top: 8px;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.check-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.check-item:hover {
  background: var(--surface-hover);
}

.check-item.done {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
}

.check-item.done .check-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.check-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.check-item.done .check-checkbox {
  background: var(--green-safe);
  border-color: var(--green-safe);
  color: #fff;
}

.check-text {
  font-size: 0.88rem;
  font-weight: 500;
  margin-left: 10px;
  flex: 1;
}

/* Equipment Potential Gauges */
.equipment-card {
  margin-bottom: 12px;
}

.equipment-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.equipment-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.equipment-hours {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
}

.equipment-progress-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}

.equipment-progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.equipment-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Map Screen */
#aero-map {
  width: 100%;
  height: 480px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  z-index: 10;
}

.map-controls-overlay {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.btn-pill {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn-pill:hover, .btn-pill.active {
  background: var(--cyan-accent);
  color: var(--text-inverse);
  border-color: var(--cyan-accent);
}

.btn-pill-primary {
  background: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
  color: #fff;
  border: none;
}

.btn-pill-primary:hover {
  filter: brightness(1.1);
}

/* Modal Dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  padding: 20px;
  animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalScale {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
}

.raw-telecom {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: #38bdf8;
  white-space: pre-wrap;
  word-break: break-all;
  margin-bottom: 12px;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  z-index: 200;
}

.nav-inner {
  max-width: 768px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 10px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  font-family: var(--font-main);
  font-size: 0.7rem;
  font-weight: 600;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  transition: var(--transition-fast);
}

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

.nav-item.active {
  color: var(--cyan-accent);
}

.nav-item.active svg {
  transform: translateY(-2px);
  filter: drop-shadow(0 0 8px var(--cyan-accent));
}

/* Form Controls */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-fast);
}

.form-input:focus {
  border-color: var(--cyan-accent);
  box-shadow: 0 0 0 2px var(--cyan-glow);
}

/* Responsive Breakpoints */
@media (min-width: 768px) {
  body {
    font-size: 16px;
  }
  
  .app-container {
    padding-top: 10px;
  }
  
  .card {
    padding: 20px;
  }
  
  #aero-map {
    height: 540px;
  }
}
