:root {
  --bg-primary: rgb(13, 13, 31);
  --bg-secondary: rgb(20, 20, 38);
  --bg-tertiary: rgb(13, 18, 31);
  --accent-blue: rgb(64, 153, 255);
  --status-green: rgb(51, 199, 89);
  --status-red: rgb(255, 89, 89);
  --status-orange: rgb(255, 166, 0);
  --status-purple: rgb(176, 92, 222);
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.5);
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.08);
  
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
}

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

body {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text-primary);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 90px; /* Space for bottom nav */
}

/* Glassmorphism Classes */
.glass-card {
  background: var(--glass-bg);
  border: 0.5px solid var(--glass-border);
  border-radius: 14px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.glass-header {
  background: rgba(13, 13, 31, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 0.5px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px;
}
.glass-nav {
  background: rgba(20, 20, 38, 0.9);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-top: 0.5px solid var(--glass-border);
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 100;
  display: flex;
  justify-content: space-around;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
}

/* Typography & Layout */
.app-container {
  max-width: 800px;
  margin: 0 auto;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.header-title { display: flex; align-items: center; gap: 8px; }
.header-title h1 { font-size: 20px; font-weight: 700; font-family: var(--font-mono); }
.header-title span { font-size: 24px; }

.live-clock {
  background: var(--glass-bg);
  border: 0.5px solid var(--glass-border);
  padding: 6px 12px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.live-clock small { color: var(--text-secondary); font-size: 10px; }

.header-search input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: white;
  font-family: var(--font-ui);
  font-size: 15px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.3s;
}
.header-search input:focus {
  border-color: var(--accent-blue);
}

.header-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
}
.update-info { display: flex; align-items: center; gap: 8px; }
.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--text-secondary);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Views */
.hidden { display: none !important; }
.view-content { padding: 16px; }

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin: 24px 0 12px 8px;
}

/* Flight Row */
.flight-list { display: flex; flex-direction: column; gap: 12px; }

.flight-card {
  display: flex;
  padding: 16px;
  gap: 16px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.flight-card:active { transform: scale(0.98); }
.flight-card.past-flight { opacity: 0.65; }
.flight-card.imminent {
  border: 1.5px solid rgba(64, 153, 255, 0.4);
  box-shadow: 0 0 16px rgba(64, 153, 255, 0.15);
}

.airline-logo-circle {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; justify-content: center; align-items: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 14px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

.flight-info { flex: 1; min-width: 0; }
.flight-row-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.flight-number-box { display: flex; align-items: center; gap: 8px; }
.flight-number { font-family: var(--font-mono); font-weight: 700; font-size: 16px; }
.badge-dom {
  background: rgba(255, 166, 0, 0.3);
  color: var(--status-orange);
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
}
.status-badge {
  font-size: 11px; font-weight: 600;
  padding: 4px 8px; border-radius: 12px;
  display: flex; align-items: center; gap: 4px;
}

.flight-route {
  font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 12px;
}
.route-via { font-size: 12px; color: var(--text-secondary); font-weight: 400; }

.flight-times {
  display: flex; gap: 24px; font-family: var(--font-mono); font-size: 13px;
}
.time-col { display: flex; flex-direction: column; }
.time-label { font-family: var(--font-ui); font-size: 10px; color: var(--text-secondary); margin-bottom: 2px; }
.time-val { font-weight: 600; }

.gate-info {
  display: flex; justify-content: flex-end; gap: 8px; flex: 1; align-items: flex-end;
}
.gate-badge {
  background: rgba(255,255,255,0.1);
  font-size: 11px; padding: 4px 8px; border-radius: 6px;
  display: flex; align-items: center; gap: 4px;
}

/* Nav */
.nav-btn {
  background: none; border: none; color: var(--text-secondary);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; padding: 4px 16px;
}
.nav-btn.active { color: var(--accent-blue); }
.nav-icon { font-size: 22px; }
.nav-label { font-size: 11px; font-weight: 500; }
.icon-wrapper { position: relative; }
.badge {
  position: absolute; top: -4px; right: -8px;
  background: var(--accent-blue); color: white;
  font-size: 10px; font-weight: 700;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* Tracking / Empty State */
.tracking-empty { text-align: center; padding: 60px 20px; }
.pulse-icon { font-size: 48px; margin-bottom: 16px; animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.1); opacity: 0.7; } 100% { transform: scale(1); opacity: 1; } }
.tracking-empty h3 { font-size: 18px; margin-bottom: 8px; }
.tracking-empty p { color: var(--text-secondary); font-size: 14px; line-height: 1.5; }

/* AdSense Placeholder */
.ad-container-mid {
  display: flex; justify-content: center; margin: 24px 0;
}
.ad-placeholder {
  width: 300px; height: 250px;
  background: rgba(255,255,255,0.05); border: 1px dashed rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 12px;
}

/* Modal */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; }
.modal-backdrop { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-content {
  position: relative; width: 100%; max-width: 600px; max-height: 90vh;
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  padding: 24px; overflow-y: auto; padding-bottom: calc(24px + env(safe-area-inset-bottom));
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,0.1); border: none; color: white;
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 20px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* App Footer */
.app-footer {
  text-align: center; padding: 24px 0; font-size: 12px; color: var(--text-secondary);
}
.app-footer a { color: var(--text-secondary); text-decoration: none; margin: 0 8px; }

/* Colors Utility Classes */
.c-green { color: var(--status-green); }
.c-red { color: var(--status-red); }
.c-white { color: white; }

/* Modal Body specific styles will be dynamically injected, but we style the base here */
.modal-header-top { text-align: center; margin-bottom: 24px; }
.modal-logo { width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 24px; font-weight: 700; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.modal-airline { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.modal-flight-num { font-size: 36px; font-weight: 700; font-family: var(--font-mono); margin-bottom: 8px; }
.modal-status-bar { border-radius: 8px; padding: 12px; text-align: center; font-weight: 700; letter-spacing: 1px; margin-bottom: 24px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.modal-route { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; position: relative; }
.route-point { text-align: center; width: 40%; }
.route-iata { font-size: 32px; font-family: var(--font-mono); font-weight: 700; }
.route-city { font-size: 14px; color: var(--text-secondary); }
.route-line { flex: 1; height: 2px; background: rgba(255,255,255,0.1); position: relative; display: flex; justify-content: center; align-items: center; }
.route-plane { font-size: 20px; animation: fly 3s infinite linear; position: absolute; }
@keyframes fly { 0% { left: 0; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
.modal-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; text-align: center; }
.modal-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
.info-box { background: rgba(255,255,255,0.03); border-radius: 12px; padding: 12px; border: 1px solid rgba(255,255,255,0.05); }
.track-btn { width: 100%; padding: 16px; border-radius: 16px; border: none; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.track-btn.add { background: var(--accent-blue); color: white; }
.track-btn.remove { background: rgba(255, 89, 89, 0.2); color: var(--status-red); border: 1px solid rgba(255, 89, 89, 0.3); }

/* SEO Content Section */
.seo-content {
  margin: 32px 16px 24px 16px;
  padding: 24px;
  color: var(--text-secondary);
}
.seo-content h2 {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 12px;
  font-weight: 600;
}
.seo-content h3 {
  font-size: 15px;
  color: var(--text-primary);
  margin-top: 20px;
  margin-bottom: 8px;
  font-weight: 600;
}
.seo-content p {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
}
.seo-content p:last-child {
  margin-bottom: 0;
}
.seo-content strong {
  color: var(--text-primary);
}
.seo-content em {
  color: var(--accent-blue);
  font-style: normal;
}
