/* ==========================================================================
   VOLARE — unified dark flight-operations console
   Avionics micro-interactions: sonar pings, geodesic dash-flow, HUD chrome.
   ========================================================================== */

:root {
    --sonar-sky: #38bdf8;
    --sonar-emerald: #10b981;
    --sonar-amber: #f59e0b;
    --hud-border: rgba(51, 65, 85, 0.8);
}

html, body, #map {
  background: #242424 !important;

    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: #020617;
}

#map {
  background: #242424 !important;

    position: absolute;
    inset: 0;
}

/* Slight desaturation + contrast lift on the basemap so HUD colors pop */
.leaflet-tile-pane {
    filter: saturate(0.85) brightness(0.95);
}

.leaflet-control-zoom a {
    background-color: rgba(2, 6, 23, 0.85) !important;
    color: #7dd3fc !important;
    border-color: var(--hud-border) !important;
}
.leaflet-control-zoom a:hover {
    background-color: rgba(15, 23, 42, 0.95) !important;
}
.leaflet-control-attribution {
    background: rgba(2, 6, 23, 0.6) !important;
    color: #64748b !important;
}
.leaflet-control-attribution a { color: #94a3b8 !important; }

/* Smooth cinematic transitions on Leaflet vector paths */
.leaflet-interactive {
    transition: r 0.4s cubic-bezier(0.25, 1, 0.5, 1),
                stroke 0.3s ease,
                stroke-width 0.3s ease,
                fill-opacity 0.3s ease;
}

/* ---------------------------------------------------------------------
   Sonar ping marker (L.divIcon)
   --------------------------------------------------------------------- */
.sonar-marker {
    position: relative;
    width: 1px;
    height: 1px;
    --sonar-color: var(--sonar-sky);
}

.sonar-marker.emerald { --sonar-color: var(--sonar-emerald); }
.sonar-marker.amber { --sonar-color: var(--sonar-amber); }

.sonar-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 9px;
    height: 9px;
    margin: -4.5px 0 0 -4.5px;
    border-radius: 50%;
    background: var(--sonar-color);
    box-shadow: 0 0 6px 2px var(--sonar-color), 0 0 14px 4px color-mix(in srgb, var(--sonar-color) 60%, transparent);
    animation: sonarCore 1.8s ease-in-out infinite;
    z-index: 3;
}

.sonar-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 9px;
    height: 9px;
    margin: -4.5px 0 0 -4.5px;
    border-radius: 50%;
    border: 1.5px solid var(--sonar-color);
    opacity: 0;
    animation: sonarPing 2.4s cubic-bezier(0.2, 0.7, 0.4, 1) infinite;
}

.sonar-ring.r1 { animation-delay: 0s; }
.sonar-ring.r2 { animation-delay: 0.8s; }
.sonar-ring.r3 { animation-delay: 1.6s; }

@keyframes sonarPing {
    0%   { transform: scale(1);    opacity: 0.85; }
    100% { transform: scale(9);    opacity: 0; }
}

@keyframes sonarCore {
    0%, 100% { transform: scale(1);    opacity: 1; }
    50%      { transform: scale(1.25); opacity: 0.75; }
}

.sonar-label {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #e2e8f0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 0 8px rgba(2,6,23,0.9);
    white-space: nowrap;
    pointer-events: none;
}

/* ---------------------------------------------------------------------
   Flight arc dash-flow — radar telemetry streaming look
   --------------------------------------------------------------------- */
.flight-arc {
    animation: dashTravel 1.1s linear infinite;
    filter: drop-shadow(0 0 3px currentColor);
}

@keyframes dashTravel {
    to { stroke-dashoffset: -24; }
}

.flight-arc-glow {
    opacity: 0.25;
    filter: blur(2px);
}

/* ---------------------------------------------------------------------
   HUD chrome
   --------------------------------------------------------------------- */
.hud-panel {
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}
.hud-panel::-webkit-scrollbar { width: 6px; }
.hud-panel::-webkit-scrollbar-track { background: transparent; }
.hud-panel::-webkit-scrollbar-thumb { background: #334155; border-radius: 999px; }

.hud-scanline {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(56,189,248,0.04) 0%, rgba(56,189,248,0) 4%);
    opacity: 0.6;
}

/* Segmented mode toggle */
.mode-toggle {
    position: relative;
    display: inline-flex;
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid var(--hud-border);
    border-radius: 9999px;
    padding: 3px;
}
.mode-toggle button {
    position: relative;
    z-index: 1;
    transition: color 0.25s ease;
}
.mode-toggle .mode-pill {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    border-radius: 9999px;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.45);
    transition: transform 0.35s cubic-bezier(0.65, 0, 0.35, 1);
}
.mode-toggle[data-mode="market"] .mode-pill {
    transform: translateX(100%);
}

/* Entry animations */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.entry-anim {
    animation: fadeSlideUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Cold-start micro badge */
@keyframes badgePulse {
    0%, 100% { opacity: 0.65; }
    50%      { opacity: 1; }
}
.cold-start-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    animation: fadeSlideUp 0.3s ease both, badgePulse 1.6s ease-in-out infinite;
}
.cold-start-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sonar-amber);
    box-shadow: 0 0 6px 1px var(--sonar-amber);
}

/* Prompt chips */
.prompt-chip {
    transition: all 0.2s ease;
}
.prompt-chip:hover {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.5);
    color: #e0f2fe;
    transform: translateY(-1px);
}

/* SQL syntax highlighting (hand-rolled, no external deps) */
.sql-block {
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}
.sql-kw   { color: #c084fc; font-weight: 600; }
.sql-fn   { color: #38bdf8; }
.sql-str  { color: #86efac; }
.sql-num  { color: #fbbf24; }
.sql-com  { color: #64748b; font-style: italic; }

.copy-btn {
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.copy-btn:active { transform: scale(0.94); }
.copy-btn.copied {
    background: rgba(16, 185, 129, 0.18) !important;
    color: #6ee7b7 !important;
    border-color: rgba(16, 185, 129, 0.5) !important;
}

/* Results drawer */
.results-drawer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.results-drawer[data-open="true"] {
    max-height: 320px;
    overflow-y: auto;
}
.results-drawer.drawer-tall[data-open="true"] {
    max-height: 420px;
}

.data-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 11px;
}
.data-table th {
    position: sticky;
    top: 0;
    background: #0f172a;
    color: #7dd3fc;
    text-align: left;
    padding: 6px 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--hud-border);
}
.data-table td {
    padding: 5px 8px;
    color: #cbd5e1;
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
    white-space: nowrap;
}
.data-table tr:hover td {
    background: rgba(56, 189, 248, 0.06);
}

/* Chevron rotation */
.chevron {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.chevron[data-open="true"] {
    transform: rotate(180deg);
}

/* Route comparison cards */
.route-card {
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.route-card:hover {
    transform: translateY(-2px);
}

/* Airport search suggestions */
input::-webkit-calendar-picker-indicator { display: none !important; }

/* Utility: number counter target ensures no layout shift */
.counter-num { font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
    .hud-panel {
        width: calc(100vw - 24px) !important;
        max-height: 60vh;
    }
}
