/* Contrail Claude-Inspired Minimalist Aesthetic & Mobile Optimizations */
:root {
  --bg-primary: #0e0f12;
  --bg-secondary: #141519;
  --bg-tertiary: #1b1d23;
  --bg-elevated: #22252c;
  --border-subtle: #282a32;
  --border-strong: #383b46;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent-amber: #d97706;
  --accent-amber-light: #f59e0b;
  --accent-amber-glow: rgba(217, 119, 6, 0.15);
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.15);
  --accent-violet: #8b5cf6;
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.45);
  --shadow-dropdown: 0 10px 30px rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

input, select, textarea {
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 15px; /* >= 16px on mobile inputs prevents unwanted iOS zoom */
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-amber);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-amber-glow);
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(14, 15, 18, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  z-index: 1002;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  background: var(--bg-tertiary);
  color: var(--accent-amber-light);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s ease;
  cursor: pointer;
  padding: 6px 0;
}

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

.lang-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Mobile Hamburger Button */
.mobile-menu-btn {
  display: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 22px;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.mobile-menu-btn:hover {
  background: var(--bg-tertiary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  cursor: pointer;
  min-height: 38px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  min-height: 32px;
}

.btn-primary {
  background: #f3f4f6;
  color: #111827;
  font-weight: 600;
}

.btn-primary:hover {
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(255, 255, 255, 0.18);
}

.btn-amber {
  background: var(--accent-amber);
  color: #ffffff;
  font-weight: 600;
}

.btn-amber:hover {
  background: var(--accent-amber-light);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-secondary);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Landing Page Hero */
.hero-container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 72px 24px 48px;
  text-align: center;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-amber-light);
  margin-bottom: 24px;
}

.hero-pill .dot {
  width: 6px;
  height: 6px;
  background: var(--accent-amber-light);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-amber);
}

.hero-title {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -1.2px;
  line-height: 1.15;
  margin-bottom: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #a1a1aa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto 36px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

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

.feature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.feature-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 19px;
}

.feature-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.feature-card p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Footer & Legal Notice */
.site-footer {
  margin-top: auto;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 48px 24px 36px;
  font-size: 13px;
  color: var(--text-secondary);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.footer-compliance-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 28px;
}

.compliance-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-amber-light);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.data-sources-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  font-size: 12.5px;
}

.data-sources-list li {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.data-sources-list a {
  color: var(--accent-blue);
  text-decoration: underline;
}

.citation-quote {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-tertiary);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-amber);
  color: #d1d5db;
  line-height: 1.5;
  margin: 12px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.notice-disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-muted);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 26px;
  box-shadow: var(--shadow-dropdown);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 6px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 15px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  font-size: 16px; /* Prevents auto-zoom in mobile Safari */
}

.form-row {
  display: flex;
  gap: 8px;
}

.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 16px 0;
}

.form-checkbox input {
  margin-top: 2px;
  min-width: 18px;
  min-height: 18px;
}

.commercial-warning {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  color: #fca5a5;
  margin-bottom: 16px;
  line-height: 1.45;
}

.captcha-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.captcha-img-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
}

.captcha-img-wrap img {
  display: block;
  height: 42px;
}

/* Console App Layout */
.app-container {
  display: flex;
  flex: 1;
  height: calc(100vh - 64px);
  overflow: hidden;
}

.sidebar {
  width: 250px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.sidebar-nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 40px;
}

.sidebar-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-muted);
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-primary);
  -webkit-overflow-scrolling: touch;
}

/* Mobile Console Navigation Bar (Visible only on small screens) */
.mobile-console-bar {
  display: none;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 12px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  gap: 8px;
}

.mobile-console-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  cursor: pointer;
  flex-shrink: 0;
}

.mobile-console-pill.active {
  background: var(--accent-amber);
  color: #ffffff;
  font-weight: 600;
}

/* Overview & Radar Map */
.stats-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.map-container-wrap {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 24px;
}

.map-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.map-title {
  font-size: 14.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#flight-radar-map {
  width: 100%;
  height: 520px;
  background: #090a0d;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
  min-width: 600px; /* guarantees readable tabular format */
}

th {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  white-space: nowrap;
}

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

.badge-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-active {
  background: var(--success-bg);
  color: var(--success);
}

.badge-banned, .badge-revoked {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-admin {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-violet);
}

/* Code blocks */
.code-block {
  background: #090a0d;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #e2e8f0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 10px 0 16px;
}

/* Leaflet Dark Customizations */
.leaflet-popup-content-wrapper {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-dropdown) !important;
}

.leaflet-popup-tip {
  background: var(--bg-secondary) !important;
}

.leaflet-popup-content {
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.5;
  margin: 12px 14px !important;
}

.flight-popup-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-amber-light);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flight-popup-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.flight-popup-row:last-child {
  border-bottom: none;
}

/* ---------------------------------------------------- */
/* MOBILE RESPONSIVE OPTIMIZATIONS (< 768px)            */
/* ---------------------------------------------------- */
@media (max-width: 768px) {
  .topbar {
    padding: 0 14px;
    height: 58px;
  }

  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Slide-down mobile nav drawer */
  .topbar-right {
    position: fixed;
    top: 58px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    flex-direction: column;
    align-items: stretch;
    padding: 16px 20px;
    gap: 14px;
    display: none;
    box-shadow: var(--shadow-dropdown);
    z-index: 999;
  }

  .topbar-right.mobile-active {
    display: flex;
  }

  .nav-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
  }

  .nav-link {
    font-size: 15px;
    width: 100%;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  }

  .lang-select {
    width: 100%;
    padding: 8px 12px;
  }

  #unauth-nav, #auth-nav {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  #unauth-nav .btn, #auth-nav .btn {
    width: 100%;
  }

  /* Hero Section on Mobile */
  .hero-container {
    padding: 42px 16px 28px;
  }

  .hero-title {
    font-size: 28px;
    letter-spacing: -0.6px;
    margin-bottom: 14px;
  }

  .hero-desc {
    font-size: 15px;
    margin-bottom: 24px;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
  }

  /* Features Grid on Mobile */
  .features-container {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 0 16px;
    margin: 20px auto 40px;
  }

  /* Map size on Mobile */
  #flight-radar-map {
    height: 380px;
  }

  /* Console Container on Mobile */
  .app-container {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 58px);
  }

  .sidebar {
    display: none; /* Hidden on mobile; replaced by mobile horizontal tab bar */
  }

  .mobile-console-bar {
    display: flex;
  }

  .main-content {
    padding: 16px;
  }

  .stats-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-value {
    font-size: 20px;
  }

  /* Modals on Mobile: Bottom Sheet appearance */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    max-width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 22px 18px env(safe-area-inset-bottom, 20px);
    max-height: 85vh;
  }

  /* Form row wrapping */
  .form-row {
    flex-direction: column;
  }
}

/* Cap PoW Widget Styling */
cap-widget {
  display: block;
  width: 100%;
  margin: 12px 0;
  box-sizing: border-box;
}
