/* SkyPass Transit Visa & Travel Validity Checker - Stylesheet */

:root {
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;

  --success-bg: #f0fdf4;
  --success-border: #86efac;
  --success-text: #166534;
  --success-accent: #22c55e;

  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;
  --warning-accent: #f59e0b;

  --caution-bg: #fff7ed;
  --caution-border: #fed7aa;
  --caution-text: #9a3412;
  --caution-accent: #f97316;

  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #991b1b;
  --danger-accent: #ef4444;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg-page: #090d16;
    --bg-surface: #111827;
    --bg-subtle: #1f2937;
    --bg-hover: #374151;
    --border-color: #374151;
    --border-focus: #60a5fa;

    --text-main: #f9fafb;
    --text-muted: #cbd5e1;
    --text-light: #94a3b8;

    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-light: #1e293b;

    --success-bg: #052e16;
    --success-border: #166534;
    --success-text: #86efac;
    --success-accent: #22c55e;

    --warning-bg: #451a03;
    --warning-border: #78350f;
    --warning-text: #fde68a;
    --warning-accent: #fbbf24;

    --caution-bg: #431407;
    --caution-border: #7c2d12;
    --caution-text: #fed7aa;
    --caution-accent: #fb923c;

    --danger-bg: #450a0a;
    --danger-border: #7f1d1d;
    --danger-text: #fecaca;
    --danger-accent: #f87171;
  }
}

html.dark, body.dark {
  --bg-page: #090d16;
  --bg-surface: #111827;
  --bg-subtle: #1f2937;
  --bg-hover: #374151;
  --border-color: #374151;
  --border-focus: #60a5fa;

  --text-main: #f9fafb;
  --text-muted: #cbd5e1;
  --text-light: #94a3b8;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: #1e293b;

  --success-bg: #052e16;
  --success-border: #166534;
  --success-text: #86efac;
  --success-accent: #22c55e;

  --warning-bg: #451a03;
  --warning-border: #78350f;
  --warning-text: #fde68a;
  --warning-accent: #fbbf24;

  --caution-bg: #431407;
  --caution-border: #7c2d12;
  --caution-text: #fed7aa;
  --caution-accent: #fb923c;

  --danger-bg: #450a0a;
  --danger-border: #7f1d1d;
  --danger-text: #fecaca;
  --danger-accent: #f87171;
}

html.light, body.light {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;

  --success-bg: #f0fdf4;
  --success-border: #86efac;
  --success-text: #166534;
  --success-accent: #22c55e;

  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;
  --warning-accent: #f59e0b;

  --caution-bg: #fff7ed;
  --caution-border: #fed7aa;
  --caution-text: #9a3412;
  --caution-accent: #f97316;

  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #991b1b;
  --danger-accent: #ef4444;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: 0;
  margin: 0;
}

/* Header */
.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.logo-badge {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.rules-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-muted);
  white-space: nowrap;
}

.rules-sync-badge .sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-light);
}

.rules-sync-badge.sync-live {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}

.rules-sync-badge.sync-live .sync-dot {
  background: #22c55e;
}

.rules-sync-badge.sync-offline {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning-text);
}

.rules-sync-badge.sync-offline .sync-dot {
  background: #f59e0b;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

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

/* Presets Bar */
.presets-section {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 20px;
}

.presets-container {
  max-width: 1240px;
  margin: 0 auto;
}

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

.presets-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.presets-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.preset-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.preset-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Layout */
.main-container {
  max-width: 1360px;
  margin: 20px auto 40px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Trip Builder: Steps 1–4 Side-by-Side */
.builder-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

@media (max-width: 1180px) {
  .steps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .steps-grid {
    grid-template-columns: 1fr;
  }
}

.step-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Submit Action Bar */
.submit-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.submit-preview {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.submit-preview strong {
  color: var(--text-main);
}

.submit-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dirty-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--warning-text);
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.btn-submit {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  letter-spacing: 0.01em;
}

.btn-submit:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.38);
}

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

.submit-plane-icon {
  display: inline-block;
  transition: transform 0.2s ease;
}

.btn-submit:hover .submit-plane-icon {
  transform: translateX(3px) rotate(-8deg);
}

/* Required Indicators & Validation */
.req-star {
  color: #ef4444;
  font-weight: 800;
  margin-left: 2px;
}

.required-hint {
  font-size: 12px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 4px;
}

.input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16) !important;
}

.radio-group-error {
  padding: 6px;
  border: 1.5px solid #ef4444;
  border-radius: var(--radius-md);
  background: var(--danger-bg);
}

.form-error-banner {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-left: 4px solid var(--danger-accent);
  color: var(--danger-text);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.results-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.step-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

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

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Radio Cards (Ticket Type) */
.radio-cards-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.radio-cards-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.radio-card {
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.radio-card:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}

.radio-card.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.radio-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.radio-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Transit Stops List */
.transits-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.transit-stop-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  position: relative;
  transition: border-color 0.15s ease;
}

.transit-stop-card:hover {
  border-color: #cbd5e1;
}

.transit-stop-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stop-tag {
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.btn-remove-stop {
  background: none;
  border: none;
  color: var(--danger-accent);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-remove-stop:hover {
  background: var(--danger-bg);
}

.btn-add-stop {
  width: 100%;
  padding: 10px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-add-stop:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

/* Checkbox Pills for Other Visas */
.checkbox-pills-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.checkbox-pill-label {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.checkbox-pill-label:hover {
  background: var(--bg-hover);
}

.checkbox-pill-label input:checked + span {
  font-weight: 600;
  color: var(--primary);
}

/* Results Section */
.results-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: results-fade-in 0.35s ease-out;
}

.results-panel.results-hidden {
  display: none;
}

@keyframes results-fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.results-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.results-section-heading {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

/* Verdict Banners */
.verdict-banner {
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 2px solid;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.verdict-banner.verdict-clear {
  background: var(--success-bg);
  border-color: var(--success-accent);
  color: var(--success-text);
}

.verdict-banner.verdict-exemption {
  background: var(--warning-bg);
  border-color: var(--warning-accent);
  color: var(--warning-text);
}

.verdict-banner.verdict-visa_required {
  background: var(--caution-bg);
  border-color: var(--caution-accent);
  color: var(--caution-text);
}

.verdict-banner.verdict-denied {
  background: var(--danger-bg);
  border-color: var(--danger-accent);
  color: var(--danger-text);
}

.verdict-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.verdict-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.verdict-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 6px;
}

.verdict-summary {
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.95;
}

/* Creative Animated Live Itinerary Transit Path */
.route-track-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.route-track-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.route-track-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-main);
}

.route-track-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.flight-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-clear { background: #22c55e; }
.dot-exemption { background: #f59e0b; }
.dot-visa { background: #f97316; }
.dot-denied { background: #ef4444; }

.flight-stage {
  background: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.07), transparent 70%), var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 26px 20px 22px;
  overflow-x: auto;
}

.flight-corridor {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 580px;
  gap: 0;
  position: relative;
}

/* Airport Beacon Nodes */
.airport-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 3;
  min-width: 110px;
  padding: 10px 8px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.airport-node:hover {
  transform: translateY(-2px);
}

.airport-node.node-clear {
  border-color: var(--success-accent);
}

.airport-node.node-exemption {
  border-color: var(--warning-accent);
}

.airport-node.node-visa_required {
  border-color: var(--caution-accent);
  background: var(--caution-bg);
}

.airport-node.node-denied {
  border-color: #ef4444;
  background: var(--danger-bg);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.16);
}

.airport-beacon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-bottom: 6px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
  font-weight: 800;
}

.beacon-clear {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.22);
}

.beacon-exemption {
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.24);
}

.beacon-visa_required {
  background: #f97316;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.26);
  animation: beacon-alert 1.8s infinite;
}

.beacon-denied {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.3);
  animation: beacon-alert 1.3s infinite;
}

@keyframes beacon-alert {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.node-code {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.airport-node.node-denied .node-code {
  color: #dc2626;
}

.node-city {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
}

.node-status-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: var(--radius-full);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Animated Flight Leg Connector */
.flight-leg {
  flex: 1;
  min-width: 110px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.flight-sky-lane {
  width: 100%;
  height: 46px;
  position: relative;
  display: flex;
  align-items: center;
  overflow: visible;
}

.flight-track-line {
  width: 100%;
  height: 3px;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  background: repeating-linear-gradient(
    90deg,
    var(--leg-color, #22c55e) 0 10px,
    transparent 10px 18px
  );
  background-size: 36px 3px;
  animation: track-flow 1.2s linear infinite;
}

.flight-leg.leg-clear {
  --leg-color: #22c55e;
  --leg-glow: rgba(34, 197, 94, 0.35);
}

.flight-leg.leg-exemption {
  --leg-color: #f59e0b;
  --leg-glow: rgba(245, 158, 11, 0.35);
}

.flight-leg.leg-visa_required {
  --leg-color: #f97316;
  --leg-glow: rgba(249, 115, 22, 0.4);
}

.flight-leg.leg-denied {
  --leg-color: #ef4444;
  --leg-glow: rgba(239, 68, 68, 0.5);
}

.flight-leg.leg-denied .flight-track-line {
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    #ef4444 0 8px,
    rgba(239, 68, 68, 0.25) 8px 16px
  );
  background-size: 32px 4px;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.45);
  animation: none;
}

@keyframes track-flow {
  from { background-position: 0 0; }
  to { background-position: 36px 0; }
}

/* Animated Airplane Sprite */
.flying-plane {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%);
  font-size: 18px;
  line-height: 1;
  color: var(--leg-color, #22c55e);
  filter: drop-shadow(0 2px 6px var(--leg-glow));
  z-index: 4;
  pointer-events: none;
  animation: fly-across 3.2s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

@keyframes fly-across {
  0% {
    left: 6%;
    opacity: 0;
    transform: translate(-50%, -42%) scale(0.85);
  }
  12% {
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -62%) scale(1.08);
  }
  88% {
    opacity: 1;
  }
  100% {
    left: 94%;
    opacity: 0;
    transform: translate(-50%, -42%) scale(0.85);
  }
}

/* Plane halts at barrier on blocked/denied leg */
.flight-leg.leg-denied .flying-plane {
  color: #ef4444;
  animation: fly-blocked 2.6s ease-in-out infinite;
}

@keyframes fly-blocked {
  0% {
    left: 10%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  18% {
    opacity: 1;
  }
  46% {
    left: 42%;
    transform: translate(-50%, -50%) scale(1.02);
  }
  54% {
    left: 38%;
    transform: translate(-50%, -50%) rotate(-12deg) scale(1);
  }
  64% {
    left: 41%;
    transform: translate(-50%, -50%) rotate(8deg) scale(1);
  }
  85% {
    left: 40%;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    left: 36%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.85);
  }
}

/* Plane pauses at checkpoint on visa-required leg */
.flight-leg.leg-visa_required .flying-plane {
  color: #f97316;
  animation: fly-checkpoint 3.2s ease-in-out infinite;
}

@keyframes fly-checkpoint {
  0% {
    left: 8%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.85);
  }
  15% { opacity: 1; }
  45%, 65% {
    left: 42%;
    opacity: 1;
    transform: translate(-50%, -56%) scale(1.05);
  }
  90% { opacity: 1; }
  100% {
    left: 42%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.85);
  }
}

/* Red Blocked Barrier & Visa Checkpoint Markers */
.leg-barrier {
  position: absolute;
  top: 50%;
  left: 55%;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.28);
  animation: beacon-alert 1.4s infinite;
}

.leg-checkpoint {
  position: absolute;
  top: 50%;
  left: 55%;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f97316;
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.25);
}

.flight-leg-label {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-top: 2px;
  white-space: nowrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.flight-leg.leg-denied .flight-leg-label {
  background: var(--danger-bg);
  border-color: #ef4444;
  color: #dc2626;
}

.flight-leg.leg-visa_required .flight-leg-label {
  background: var(--caution-bg);
  border-color: #f97316;
  color: var(--caution-text);
}

.flight-leg.leg-exemption .flight-leg-label {
  background: var(--warning-bg);
  border-color: #f59e0b;
  color: var(--warning-text);
}

.flight-leg.leg-clear .flight-leg-label {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}

/* Leg Evaluation Cards */
.leg-evaluations-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.leg-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

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

.leg-airport-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.leg-code-badge {
  font-size: 14px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
}

.leg-name-col {
  display: flex;
  flex-direction: column;
}

.leg-airport-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.leg-country-name {
  font-size: 11px;
  color: var(--text-muted);
}

.leg-status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-pill-clear {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.status-pill-exemption {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.status-pill-visa_required {
  background: var(--caution-bg);
  color: var(--caution-text);
  border: 1px solid var(--caution-border);
}

.status-pill-denied {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.leg-details-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.leg-details-list li {
  position: relative;
  padding-left: 18px;
}

.leg-details-list li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--primary);
  font-weight: bold;
}

.leg-warning-item {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-top: 8px;
  line-height: 1.4;
}

.leg-official-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  margin-top: 10px;
}

.leg-official-link:hover {
  text-decoration: underline;
}

/* Traps & Warnings Section */
.trap-alerts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trap-card {
  border-radius: var(--radius-md);
  padding: 16px;
  border-left: 4px solid;
}

.trap-card.trap-denied {
  background: var(--danger-bg);
  border-left-color: var(--danger-accent);
  color: var(--danger-text);
}

.trap-card.trap-caution {
  background: var(--warning-bg);
  border-left-color: var(--warning-accent);
  color: var(--warning-text);
}

.trap-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.trap-body {
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.trap-action {
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-sm);
  display: inline-block;
}

/* Action Checklist */
.checklist-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.checklist-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.checklist-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .checklist-grid {
    grid-template-columns: 1fr;
  }
}

.checklist-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
}

.checklist-item-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.checklist-item-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Buttons */
.btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-subtle);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

/* =========================================================
   Mobile-Friendly Enhancements (Android / iOS Portrait)
   ========================================================= */
html, body {
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.presets-scroll {
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 680px) {
  /* Header: compact & touch-friendly */
  .header-container {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .brand-wrapper {
    gap: 10px;
  }

  .logo-badge {
    width: 36px;
    height: 36px;
    font-size: 18px;
    flex-shrink: 0;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-subtitle {
    font-size: 11px;
    line-height: 1.3;
  }

  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .header-actions .btn {
    padding: 8px 6px;
    font-size: 12px;
    min-height: 38px;
    white-space: nowrap;
  }

  /* Presets bar */
  .presets-section {
    padding: 10px 14px;
  }

  .presets-header span:last-child {
    display: none;
  }

  .preset-chip {
    padding: 8px 12px;
    font-size: 12px;
  }

  /* Main spacing */
  .main-container {
    margin: 14px auto 32px;
    padding: 0 12px;
    gap: 16px;
  }

  .steps-grid {
    gap: 12px;
  }

  .card {
    padding: 14px;
    border-radius: var(--radius-md);
  }

  /* Prevent mobile zoom & ensure 44px touch targets */
  .form-input, .form-select {
    font-size: 16px;
    padding: 10px 12px;
    min-height: 44px;
  }

  .form-grid-2 {
    gap: 10px;
  }

  .radio-card {
    padding: 12px;
  }

  .checkbox-pill-label {
    padding: 9px 10px;
    font-size: 12px;
    min-height: 40px;
  }

  .btn-add-stop {
    min-height: 44px;
    font-size: 14px;
  }

  /* Submit bar stacked with full-width primary CTA */
  .submit-bar {
    padding: 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .submit-preview {
    font-size: 12px;
    line-height: 1.4;
  }

  .submit-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .submit-actions .btn-submit {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
    order: 1;
  }

  .submit-actions #btn-clear-form {
    width: 100%;
    min-height: 42px;
    order: 2;
  }

  .dirty-badge {
    text-align: center;
  }

  /* Results top bar */
  .results-top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .results-top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .results-top-actions .btn {
    min-height: 42px;
    font-size: 12px;
    padding: 8px 10px;
  }

  /* Verdict banner */
  .verdict-banner {
    padding: 16px;
  }

  .verdict-top {
    gap: 12px;
  }

  .verdict-icon {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  .verdict-title {
    font-size: 17px;
  }

  .verdict-summary {
    font-size: 13px;
  }

  /* Vertical Animated Flight Corridor on Mobile (no horizontal scroll!) */
  .route-track-card {
    padding: 14px;
  }

  .route-track-header {
    margin-bottom: 12px;
  }

  .flight-legend {
    gap: 8px;
  }

  .flight-stage {
    padding: 16px 12px;
    overflow-x: visible;
  }

  .flight-corridor {
    flex-direction: column;
    min-width: 0;
    width: 100%;
    align-items: center;
    gap: 0;
  }

  .airport-node {
    width: 100%;
    max-width: 300px;
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
    padding: 10px 14px;
    gap: 10px;
  }

  .airport-beacon {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .node-code {
    font-size: 16px;
  }

  .node-city {
    margin-top: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .node-status-badge {
    margin-top: 0;
    flex-shrink: 0;
  }

  /* Vertical Flight Leg Lane */
  .flight-leg {
    width: 100%;
    max-width: 300px;
    min-width: 0;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    height: 76px;
    padding: 0;
    gap: 12px;
  }

  .flight-sky-lane {
    width: 36px;
    height: 100%;
    justify-content: center;
    align-items: stretch;
  }

  .flight-track-line {
    width: 3px;
    height: 100%;
    background: repeating-linear-gradient(
      180deg,
      var(--leg-color, #22c55e) 0 8px,
      transparent 8px 16px
    );
    background-size: 3px 32px;
    animation: track-flow-vertical 1.2s linear infinite;
  }

  .flight-leg.leg-denied .flight-track-line {
    width: 4px;
    height: 100%;
    background: repeating-linear-gradient(
      180deg,
      #ef4444 0 7px,
      rgba(239, 68, 68, 0.25) 7px 14px
    );
    background-size: 4px 28px;
    animation: none;
  }

  @keyframes track-flow-vertical {
    from { background-position: 0 0; }
    to { background-position: 0 32px; }
  }

  .flying-plane {
    left: 50%;
    top: 10%;
    transform: translate(-50%, -50%) rotate(90deg);
    animation: fly-down 2.8s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  }

  @keyframes fly-down {
    0% {
      top: 8%;
      opacity: 0;
      transform: translate(-50%, -50%) rotate(90deg) scale(0.85);
    }
    15% { opacity: 1; }
    85% { opacity: 1; }
    100% {
      top: 92%;
      opacity: 0;
      transform: translate(-50%, -50%) rotate(90deg) scale(0.85);
    }
  }

  .flight-leg.leg-denied .flying-plane {
    animation: fly-down-blocked 2.4s ease-in-out infinite;
  }

  @keyframes fly-down-blocked {
    0% {
      top: 10%;
      opacity: 0;
      transform: translate(-50%, -50%) rotate(90deg) scale(0.9);
    }
    20% { opacity: 1; }
    48% {
      top: 40%;
      transform: translate(-50%, -50%) rotate(90deg) scale(1.02);
    }
    56% {
      top: 35%;
      transform: translate(-50%, -50%) rotate(78deg) scale(1);
    }
    66% {
      top: 39%;
      transform: translate(-50%, -50%) rotate(100deg) scale(1);
    }
    85% {
      top: 38%;
      opacity: 1;
      transform: translate(-50%, -50%) rotate(90deg) scale(1);
    }
    100% {
      top: 34%;
      opacity: 0;
      transform: translate(-50%, -50%) rotate(90deg) scale(0.85);
    }
  }

  .flight-leg.leg-visa_required .flying-plane {
    animation: fly-down-checkpoint 2.8s ease-in-out infinite;
  }

  @keyframes fly-down-checkpoint {
    0% {
      top: 10%;
      opacity: 0;
      transform: translate(-50%, -50%) rotate(90deg) scale(0.85);
    }
    18% { opacity: 1; }
    46%, 68% {
      top: 40%;
      opacity: 1;
      transform: translate(-50%, -50%) rotate(90deg) scale(1.04);
    }
    88% { opacity: 1; }
    100% {
      top: 40%;
      opacity: 0;
      transform: translate(-50%, -50%) rotate(90deg) scale(0.85);
    }
  }

  .leg-barrier, .leg-checkpoint {
    left: 50%;
    top: 58%;
    transform: translate(-50%, -50%);
  }

  .flight-leg-label {
    margin-top: 0;
    font-size: 11px;
    padding: 3px 10px;
  }

  /* Leg Breakdown Cards */
  .leg-card {
    padding: 14px;
  }

  .leg-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .leg-status-pill {
    align-self: flex-start;
  }
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  margin-top: 32px;
  padding: 20px;
}

.footer-container {
  max-width: 1360px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.footer-disclaimer {
  font-size: 11px;
  color: var(--text-light);
  max-width: 760px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Print Styles */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .app-header, .presets-section, .btn-add-stop, .btn-remove-stop, .header-actions {
    display: none !important;
  }

  .main-container {
    grid-template-columns: 1fr !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .card, .verdict-banner, .leg-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
}
