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

:root {
  --bg: #0a0e17;
  --card: #111827;
  --card-hover: #1a2332;
  --border: rgba(255,255,255,0.06);
  --accent: #f97316;
  --accent-glow: rgba(249,115,22,0.3);
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  --glass: rgba(17,24,39,0.7);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

/* ===== Loading Screen ===== */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-content {
  text-align: center;
}

.loading-logo {
  margin-bottom: 12px;
  color: var(--accent);
  animation: float 2s ease-in-out infinite;
}

.loading-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), #fb923c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: loading-spin 0.8s linear infinite;
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ===== Error Screen ===== */
.error-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-content {
  text-align: center;
  padding: 40px;
}

.error-icon {
  margin-bottom: 16px;
  color: var(--text-muted);
  opacity: 0.3;
}

.error-content h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.error-content p {
  color: var(--text-dim);
  margin-bottom: 24px;
}

.error-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.error-link:hover {
  text-decoration: underline;
}

/* ===== Landing Screen ===== */
.landing-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-content {
  text-align: center;
  padding: 40px;
  max-width: 480px;
}

.landing-logo {
  color: var(--accent);
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

.landing-content h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--accent), #fb923c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.landing-tagline {
  font-size: 18px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.landing-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ===== Hero Section ===== */
.hero {
  position: relative;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px 40px;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(249,115,22,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 20% 20%, rgba(59,130,246,0.06) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 30%, rgba(168,85,247,0.05) 0%, transparent 50%);
  z-index: 0;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
  z-index: 0;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.plane-path {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.15;
}

/* ===== Avatar ===== */
.avatar-wrapper {
  position: relative;
  margin-bottom: 24px;
}

.avatar-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(from 0deg, var(--accent), #3b82f6, #a855f7, var(--accent));
  /* static gradient ring, no rotation */
}

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

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 3px solid var(--bg);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-fallback {
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
}

.status-dot {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: #22c55e;
  border: 3px solid var(--bg);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(34,197,94,0.5);
}

/* ===== Pilot Name & Badge ===== */
.pilot-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  text-align: center;
}

.pilot-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(249,115,22,0.1);
  border: 1px solid rgba(249,115,22,0.25);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 32px;
}

.pilot-badge svg {
  width: 14px;
  height: 14px;
}

/* ===== Stats Bar ===== */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  background: var(--border);
  border-radius: 20px;
  overflow: hidden;
  max-width: 780px;
  width: 100%;
  border: 1px solid var(--border);
}

.stat-item {
  background: var(--card);
  padding: 24px 12px;
  text-align: center;
  transition: background 0.3s;
  cursor: default;
}

.stat-item:hover {
  background: var(--card-hover);
}

.stat-item:first-child {
  border-radius: 18px 0 0 18px;
}

.stat-item:last-child {
  border-radius: 0 18px 18px 0;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

/* ===== Container & Sections ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 48px 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.section-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(249,115,22,0.1);
  border: 1px solid rgba(249,115,22,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 0;
  font-size: 14px;
}

/* ===== Divider ===== */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 0 auto;
  max-width: 600px;
}

/* ===== Flight Cards ===== */
.flight-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s;
  cursor: pointer;
  margin-bottom: 12px;
}

.flight-card:hover {
  background: var(--card-hover);
  border-color: rgba(249,115,22,0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.flight-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #fb923c);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.flight-icon svg {
  width: 22px;
  height: 22px;
  color: white;
}

.flight-info {
  flex: 1;
  min-width: 0;
}

.flight-name {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flight-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.flight-meta span {
  color: var(--text-dim);
}

.flight-stats {
  display: flex;
  gap: 24px;
  flex-shrink: 0;
}

.flight-stat {
  text-align: right;
}

.flight-stat-val {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 18px;
}

.flight-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

/* ===== Trips Grid ===== */
.trips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
}

.trip-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  position: relative;
}

.trip-card:hover {
  border-color: rgba(249,115,22,0.3);
  transform: translateY(-6px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.4), 0 0 0 1px rgba(249,115,22,0.1);
}

.trip-map {
  height: 160px;
  position: relative;
  overflow: hidden;
}

.trip-map .leaflet-container {
  background: #1a2332 !important;
}

.trip-status {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(8px);
  z-index: 2;
}

.trip-status.active {
  background: rgba(34,197,94,0.15);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.3);
}

.trip-status.upcoming {
  background: rgba(100,116,139,0.2);
  color: var(--text-dim);
  border: 1px solid rgba(100,116,139,0.2);
}

.trip-body {
  padding: 20px;
}

.trip-name {
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trip-details {
  display: flex;
  gap: 20px;
}

.trip-detail {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
}

.trip-detail svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s;
}

.modal-close:hover {
  background: rgba(255,255,255,0.12);
}

.modal-header {
  padding: 32px 32px 20px;
}

.modal-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-desc {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 16px;
}

.modal-stats {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.modal-stat-sep {
  color: var(--border);
}

.modal-map-container {
  padding: 0 32px;
}

.modal-map {
  width: 100%;
  height: 300px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card-hover);
}

.modal-flights {
  padding: 24px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-flight-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.modal-flight-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.modal-flight-info {
  flex: 1;
  min-width: 0;
}

.modal-flight-name {
  font-size: 14px;
  font-weight: 600;
}

.modal-flight-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== Flight Modal Stats Grid ===== */
.flight-modal-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 24px 32px 32px;
}

.flight-modal-stat {
  text-align: center;
  padding: 16px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.flight-modal-stat-val {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.flight-modal-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 48px 20px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

.footer-text {
  font-size: 13px;
  color: var(--text-muted);
}

.footer-text a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.footer-text a:hover {
  text-decoration: underline;
}

/* ===== Leaflet ===== */
.leaflet-container {
  background: var(--card-hover) !important;
}

/* ===== Animations ===== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate {
  animation: fadeUp 0.6s ease-out forwards;
  opacity: 0;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .stats-bar {
    grid-template-columns: repeat(3, 1fr);
  }

  .stat-item:first-child {
    border-radius: 18px 0 0 0;
  }

  .stat-item:nth-child(3) {
    border-radius: 0 18px 0 0;
  }

  .stat-item:nth-child(4) {
    border-radius: 0;
  }

  .stat-item:last-child {
    border-radius: 0 0 18px 0;
  }

  .stat-item:nth-last-child(3) {
    border-radius: 0 0 0 18px;
  }

  .pilot-name {
    font-size: 28px;
  }

  .hero {
    min-height: 440px;
    padding: 40px 20px 30px;
  }

  .flight-card {
    flex-wrap: wrap;
  }

  .flight-stats {
    gap: 16px;
  }

  .trips-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    margin: 12px;
    border-radius: 16px;
  }

  .modal-header {
    padding: 24px 20px 16px;
  }

  .modal-map-container {
    padding: 0 20px;
  }

  .modal-flights {
    padding: 16px 20px 24px;
  }

  .modal-map {
    height: 220px;
  }

  .flight-modal-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 16px 20px 24px;
  }

  .section {
    padding: 32px 0;
  }

  .container {
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .stat-value {
    font-size: 22px;
  }

  .flight-card {
    padding: 16px;
  }

  .flight-stats {
    width: 100%;
    justify-content: flex-start;
    gap: 20px;
  }

  .flight-stat {
    text-align: left;
  }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #334155;
}
