:root {
    --gate-panel: rgba(15, 23, 42, 0.86);
    --gate-panel-strong: rgba(8, 15, 29, 0.96);
    --gate-border: rgba(148, 163, 184, 0.2);
    --gate-sky: #38bdf8;
    --gate-clear: #34d399;
    --gate-occupied: #fb923c;
    --gate-unknown: #94a3b8;
}

body {
    min-height: 100vh;
    position: relative;
    color: #e2e8f0;
    background: #020617;
    font-family: 'Inter', sans-serif;
}

.gate-finder-shell {
    width: 100%;
    flex: none;
    overflow: hidden;
}

.gate-sync-time {
    margin-top: 0.25rem;
    color: #94a3b8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.64rem;
    line-height: 1.45;
}

.gate-workspace {
    overflow: hidden;
    background: #1e293b;
}

.gate-control {
    display: grid;
    gap: 0.35rem;
}

.gate-control label {
    color: #94a3b8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.gate-control select,
.gate-toolbar-button {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 0.65rem;
    color: #e2e8f0;
    background: rgba(30, 41, 59, 0.9);
    font-size: 0.8rem;
    font-weight: 700;
}

.gate-control select {
    min-width: 0;
    padding: 0 2.2rem 0 0.8rem;
}

.gate-toolbar-button {
    padding: 0 0.95rem;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.gate-toolbar-button:hover,
.gate-toolbar-button:focus-visible {
    border-color: rgba(56, 189, 248, 0.65);
    color: #7dd3fc;
    background: rgba(30, 58, 83, 0.95);
    outline: none;
    transform: translateY(-1px);
}

.gate-toolbar-button[aria-pressed='false'] {
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.72);
}

.gate-count {
    padding-top: 0.85rem;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    color: #94a3b8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    line-height: 1.5;
}

.gate-map-stage {
    position: relative;
    height: calc(100vh - 83px);
    min-height: 620px;
    background: #1e293b;
}

#gate-map {
    width: 100%;
    height: 100%;
    background: #1e293b;
}

.leaflet-container {
    font-family: 'Inter', sans-serif;
}

.maplibregl-canvas {
    outline: none;
}

.leaflet-control-attribution {
    color: #64748b;
    background: rgba(8, 15, 29, 0.88) !important;
}

.leaflet-control-attribution a {
    color: #7dd3fc;
}

.gate-live-panel,
.gate-controls-toggle,
.gate-map-controls {
    position: absolute;
    z-index: 1000;
    border: 1px solid var(--gate-border);
    background: rgba(8, 15, 29, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
}

.gate-live-panel {
    right: 1rem;
    bottom: 1.5rem;
    max-width: min(390px, calc(100% - 2rem));
    padding: 0.7rem 0.85rem;
    border-radius: 0.75rem;
}

.gate-controls-toggle {
    top: 1rem;
    right: 1rem;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0 1rem;
    border-radius: 9999px;
    color: #e2e8f0;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.gate-controls-toggle:hover,
.gate-controls-toggle:focus-visible,
.gate-controls-toggle[aria-expanded='true'] {
    color: #7dd3fc;
    border-color: rgba(56, 189, 248, 0.65);
    background: rgba(15, 35, 55, 0.96);
    outline: none;
}

.gate-map-controls {
    top: 4.5rem;
    right: 1rem;
    width: min(340px, calc(100% - 2rem));
    padding: 1rem;
    border-radius: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transform: translateX(calc(100% + 2rem));
    transition: transform 0.28s ease, opacity 0.2s ease;
}

.gate-map-controls.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.gate-controls-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.gate-controls-heading h2 {
    margin-top: 0.2rem;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 800;
}

.gate-controls-eyebrow {
    color: var(--gate-sky);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.gate-controls-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    margin-top: 0.75rem;
}

.gate-controls-actions #focus-airport {
    grid-column: 1 / -1;
}

.leaflet-div-icon {
    border: 0;
    background: transparent;
}

.gate-marker {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.76);
    border-radius: 9999px;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.62);
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.gate-marker:hover,
.gate-marker:focus-visible {
    transform: scale(1.25);
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.gate-marker[data-state='clear'] {
    border-color: #6ee7b7;
    background: linear-gradient(135deg, #34d399, #047857);
}

.gate-marker[data-state='occupied'] {
    border-color: #fda4af;
    background: linear-gradient(135deg, #fb7185, #be123c);
}

.gate-marker[data-state='unknown'] {
    border-color: #cbd5e1;
    background: linear-gradient(135deg, #64748b, #334155);
}

.gate-marker.is-hidden {
    display: none;
}

.aircraft-marker {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    color: var(--aircraft-color, #111827);
    filter: drop-shadow(0 0 6px var(--aircraft-glow, rgba(255, 255, 255, 0.42)));
    cursor: pointer;
}

.aircraft-marker--departure {
    --aircraft-color: #38bdf8;
    --aircraft-glow: rgba(56, 189, 248, 0.8);
}

.aircraft-marker--arrival {
    --aircraft-color: #fbbf24;
    --aircraft-glow: rgba(251, 191, 36, 0.75);
}

.aircraft-marker--transit {
    --aircraft-color: #94a3b8;
    --aircraft-glow: rgba(226, 232, 240, 0.52);
}

.aircraft-marker--unknown {
    --aircraft-color: #05070b;
    --aircraft-glow: rgba(255, 255, 255, 0.82);
}

.aircraft-marker svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.aircraft-div-icon {
    transition: transform 120ms linear;
    will-change: transform;
}

.gate-map-legend {
    position: absolute;
    z-index: 600;
    right: 1rem;
    bottom: 6.5rem;
    display: grid;
    gap: 0.5rem;
    min-width: 210px;
    padding: 0.85rem 1rem;
    border: 1px solid var(--gate-border);
    border-radius: 0.75rem;
    background: rgba(8, 15, 29, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.36);
}

.gate-legend-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: #cbd5e1;
    font-size: 0.72rem;
}

.gate-legend-title {
    margin-top: 0.1rem;
    color: #64748b;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.gate-legend-title:not(:first-child) {
    margin-top: 0.35rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.gate-legend-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 9999px;
}

.gate-legend-dot.clear { background: var(--gate-clear); }
.gate-legend-dot.occupied { background: var(--gate-occupied); }
.gate-legend-dot.unknown { background: var(--gate-unknown); }
.gate-legend-dot.departure { background: #38bdf8; }
.gate-legend-dot.arrival { background: #fbbf24; }
.gate-legend-dot.transit { background: #94a3b8; }
.gate-legend-dot.no-flight-plan {
    border: 1px solid rgba(255, 255, 255, 0.65);
    background: #05070b;
}

.flight-sidebar {
    position: absolute;
    z-index: 1100;
    top: 0;
    left: 0;
    width: 430px;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--gate-border);
    background: var(--gate-panel-strong);
    box-shadow: 18px 0 50px rgba(0, 0, 0, 0.5);
    transform: translateX(-105%);
    transition: transform 0.3s ease;
}

.flight-sidebar.is-open {
    transform: translateX(0);
}

.flight-sidebar-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem;
    border-bottom: 1px solid var(--gate-border);
}

.flight-sidebar-title {
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 800;
}

.flight-sidebar-subtitle {
    margin-top: 0.25rem;
    color: #94a3b8;
    font-size: 0.78rem;
}

.gate-icon-button {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid var(--gate-border);
    border-radius: 9999px;
    color: #cbd5e1;
    background: rgba(30, 41, 59, 0.84);
    cursor: pointer;
}

.gate-icon-button:hover,
.gate-icon-button:focus-visible {
    color: #ffffff;
    border-color: rgba(56, 189, 248, 0.65);
    outline: none;
}

.flight-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.2rem;
}

.flight-airports {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--gate-border);
    border-radius: 0.85rem;
    background: rgba(30, 41, 59, 0.58);
    text-align: center;
}

.flight-airport-code {
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.6rem;
    font-weight: 800;
}

.flight-airport-label {
    margin-top: 0.2rem;
    color: #64748b;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.flight-route-arrow {
    color: #fbbf24;
    font-size: 1.3rem;
}

.flight-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.8rem;
}

.flight-info-card,
.flight-text-card {
    padding: 0.85rem;
    border: 1px solid var(--gate-border);
    border-radius: 0.75rem;
    background: rgba(30, 41, 59, 0.52);
}

.flight-info-card dt,
.flight-text-card h3 {
    color: #94a3b8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.flight-info-card dd {
    margin-top: 0.35rem;
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 700;
}

.flight-trend-card {
    margin-top: 0.8rem;
    padding: 0.85rem;
    border: 1px solid var(--gate-border);
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.7);
}

.flight-trend-heading,
.flight-trend-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.flight-trend-heading h3,
.flight-trend-heading span,
.flight-trend-label span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.flight-trend-heading h3 {
    color: #cbd5e1;
}

.flight-trend-heading span {
    color: var(--gate-sky);
}

.flight-trend-panel {
    margin-top: 0.7rem;
    padding: 0.65rem 0.7rem 0.45rem;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 0.65rem;
    background: rgba(2, 6, 23, 0.48);
}

.flight-trend-label span {
    color: #64748b;
}

.flight-trend-label small {
    display: block;
    margin-top: 0.15rem;
    color: #475569;
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.flight-trend-label strong {
    color: #f8fafc;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
}

.flight-trend-chart {
    width: 100%;
    height: 58px;
    margin-top: 0.35rem;
    overflow: visible;
}

.flight-trend-gridline {
    stroke: rgba(148, 163, 184, 0.16);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.flight-trend-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.flight-trend-line.altitude,
.flight-trend-point.altitude {
    stroke: #38bdf8;
    fill: #38bdf8;
}

.flight-trend-line.speed,
.flight-trend-point.speed {
    stroke: #fbbf24;
    fill: #fbbf24;
}

.flight-trend-point[hidden] {
    display: none;
}

.flight-trend-note {
    margin-top: 0.65rem;
    color: #64748b;
    font-size: 0.65rem;
    line-height: 1.5;
}

.flight-text-card {
    margin-top: 0.8rem;
}

.flight-text-card p {
    max-height: 115px;
    margin-top: 0.55rem;
    overflow-y: auto;
    color: #cbd5e1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.gate-dialog {
    width: min(420px, calc(100% - 2rem));
    padding: 0;
    border: 1px solid var(--gate-border);
    border-radius: 1rem;
    color: #e2e8f0;
    background: var(--gate-panel-strong);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.62);
}

.gate-dialog::backdrop {
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(4px);
}

.gate-dialog-content {
    padding: 1.35rem;
}

.gate-dialog-heading {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
}

.gate-dialog-eyebrow {
    color: var(--gate-sky);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.gate-dialog-title {
    margin-top: 0.3rem;
    color: #ffffff;
    font-size: 1.55rem;
    font-weight: 800;
}

.gate-dialog-status {
    margin-top: 1.1rem;
    padding: 0.9rem;
    border: 1px solid var(--gate-border);
    border-radius: 0.75rem;
    background: rgba(30, 41, 59, 0.62);
}

.gate-dialog-status strong {
    display: block;
    color: #ffffff;
}

.gate-dialog-status[data-state='empty'] strong {
    color: var(--gate-clear);
}

.gate-dialog-status[data-state='occupied'] strong {
    color: var(--gate-occupied);
}

.gate-dialog-status[data-state='unavailable'] strong {
    color: var(--gate-unknown);
}

.gate-dialog-status span {
    display: block;
    margin-top: 0.25rem;
    color: #94a3b8;
    font-size: 0.76rem;
    line-height: 1.55;
}

.gate-dialog-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.8rem;
}

.gate-dialog-details[hidden],
.gate-dialog-metadata-message[hidden] {
    display: none;
}

.gate-dialog-metadata {
    grid-template-columns: 1fr;
}

.gate-dialog-metadata-message {
    margin-top: 0.8rem;
    padding: 0.75rem;
    border: 1px solid var(--gate-border);
    border-radius: 0.7rem;
    color: var(--gate-unknown);
    background: rgba(15, 23, 42, 0.7);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.gate-dialog-details div {
    padding: 0.75rem;
    border: 1px solid var(--gate-border);
    border-radius: 0.7rem;
    background: rgba(15, 23, 42, 0.7);
}

.gate-dialog-details dt {
    color: #64748b;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
}

.gate-dialog-details dd {
    margin-top: 0.3rem;
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 700;
}

.gate-map-error {
    position: absolute;
    z-index: 1200;
    inset: 0;
    display: none;
    place-items: center;
    padding: 2rem;
    color: #fecaca;
    background: rgba(8, 15, 29, 0.96);
    text-align: center;
}

.gate-map-error.is-visible {
    display: grid;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
