/* ═══════════════════════════════════════════════════════════════════════
   航班雷达 · flight-radar.css
   ───────────────────────────────────────────────────────────────────────
   · 配色一律取站点语义令牌（app.css / ios-theme.css），随浅色 / 深色主题切换；
     仅雷达屏本体保持深色仪表风格（固定色值），保证扫描线与航迹的对比度。
   · 飞行阶段色板与 public/assets/js/flight-radar.js 中的 PHASE_COLORS 保持一致。
   ═══════════════════════════════════════════════════════════════════════ */

.jx-fr {
    /* 飞行阶段色板（与 JS 同步） */
    --fr-phase-departure: #ff9f0a;
    --fr-phase-climb: #30d158;
    --fr-phase-cruise: #32ade6;
    --fr-phase-low: #64d2ff;
    --fr-phase-descent: #bf5af2;
    --fr-phase-approach: #ff453a;
    --fr-phase-ground: #8e8e93;

    /* 雷达屏（固定深色仪表风） */
    --fr-scope-1: #0a1d2e;
    --fr-scope-2: #040b14;
    --fr-scope-line: rgba(94, 214, 255, 0.20);
    --fr-scope-line-strong: rgba(94, 214, 255, 0.38);
    --fr-scope-text: rgba(188, 231, 255, 0.78);
    --fr-sweep: rgba(94, 214, 255, 0.55);

    --fr-mono: var(--ios-mono, ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace);

    padding-bottom: 3rem;
}

/* ── 顶部标题 ───────────────────────────────────────────────────────── */
.jx-fr-hero {
    padding: clamp(1.5rem, 3.2vw, 2.5rem) 0 1.25rem;
}
.jx-fr-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: .4375rem;
    padding: .3125rem .625rem;
    border: 0.5px solid var(--border-light);
    border-radius: var(--radius-full, 999px);
    background: var(--ios-fill-quaternary, rgba(120, 120, 128, 0.08));
    font-family: var(--fr-mono);
    font-size: .6875rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.jx-fr-hero__dot {
    width: .4375rem;
    height: .4375rem;
    border-radius: 50%;
    background: var(--fr-phase-climb);
    box-shadow: 0 0 0 0 rgba(48, 209, 88, .55);
    animation: jx-fr-pulse 2.4s ease-out infinite;
}
@keyframes jx-fr-pulse {
    0% { box-shadow: 0 0 0 0 rgba(48, 209, 88, .5); }
    70% { box-shadow: 0 0 0 8px rgba(48, 209, 88, 0); }
    100% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0); }
}
.jx-fr-hero h1 {
    margin: .875rem 0 .5rem;
    font-size: clamp(1.625rem, 3.6vw, 2.25rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -.022em;
    color: var(--text);
}
.jx-fr-hero p {
    margin: 0;
    max-width: 66ch;
    font-size: .9375rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

/* ── 控制条 ─────────────────────────────────────────────────────────── */
.jx-fr-bar {
    display: grid;
    grid-template-columns: minmax(200px, 1.4fr) minmax(180px, 1fr) minmax(170px, 1fr) minmax(190px, 1fr);
    gap: .875rem 1rem;
    padding: 1rem 1.125rem;
    border: 0.5px solid var(--border);
    border-radius: var(--radius-xl, 18px);
    background: var(--surface-primary);
    box-shadow: var(--shadow-md);
}
.jx-fr-field { display: flex; flex-direction: column; gap: .375rem; min-width: 0; }
.jx-fr-field__label {
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.jx-fr-field__row { display: flex; align-items: center; gap: .625rem; flex-wrap: wrap; }

.jx-fr-select {
    width: 100%;
    min-width: 0;
    padding: .5rem .625rem;
    border: 0.5px solid var(--border-light);
    border-radius: var(--radius, 10px);
    background: var(--surface-secondary, var(--surface-primary));
    color: var(--text);
    font-size: .875rem;
    line-height: 1.35;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.jx-fr-select:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.jx-fr-select--sm { width: auto; }

.jx-fr-seg {
    display: inline-flex;
    padding: .1875rem;
    border: 0.5px solid var(--border-light);
    border-radius: var(--radius, 10px);
    background: var(--ios-fill-quaternary, rgba(120, 120, 128, 0.08));
}
.jx-fr-seg__btn {
    flex: 1 1 0;
    padding: .3125rem .5rem;
    border: 0;
    border-radius: calc(var(--radius, 10px) - 3px);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--fr-mono);
    font-size: .8125rem;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--transition), color var(--transition);
}
.jx-fr-seg__btn:hover { color: var(--text); }
.jx-fr-seg__btn.is-active {
    background: var(--surface-primary);
    color: var(--accent);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.jx-fr-btn {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .4375rem .75rem;
    border: 0.5px solid var(--border-light);
    border-radius: var(--radius, 10px);
    background: var(--surface-secondary, var(--surface-primary));
    color: var(--text);
    font-size: .8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color var(--transition), background-color var(--transition);
}
.jx-fr-btn:hover { border-color: var(--accent); color: var(--accent); }

.jx-fr-check {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    font-size: .8125rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
.jx-fr-check input { accent-color: var(--accent); width: 1rem; height: 1rem; }

.jx-fr-status {
    margin: .75rem 0 0;
    font-size: .8125rem;
    color: var(--text-secondary);
}
.jx-fr-status.is-error { color: var(--fr-phase-approach); }
.jx-fr-status.is-stale { color: var(--fr-phase-departure); }

/* ── 主体两栏 ───────────────────────────────────────────────────────── */
.jx-fr-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    gap: 1.25rem;
    margin-top: 1.25rem;
    align-items: start;
}

/* ── 雷达屏 ─────────────────────────────────────────────────────────── */
.jx-fr-scope {
    position: relative;
    isolation: isolate;
    aspect-ratio: 1 / 1;
    max-height: min(78vh, 760px);
    margin: 0 auto;
    width: 100%;
    border: 0.5px solid var(--border);
    border-radius: var(--radius-xl, 18px);
    background: radial-gradient(circle at 50% 45%, var(--fr-scope-1) 0%, var(--fr-scope-2) 78%);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.jx-fr-scope canvas { display: block; width: 100%; height: 100%; }

.jx-fr-scope__busy {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background: rgba(3, 9, 16, .45);
    color: #cfeaff;
    font-size: .8125rem;
    letter-spacing: .04em;
    backdrop-filter: blur(1px);
}
.jx-fr-spinner {
    width: .875rem;
    height: .875rem;
    border: 2px solid rgba(207, 234, 255, .35);
    border-top-color: #cfeaff;
    border-radius: 50%;
    animation: jx-fr-spin .8s linear infinite;
}
@keyframes jx-fr-spin { to { transform: rotate(360deg); } }

.jx-fr-scope__meta {
    position: absolute;
    left: .75rem;
    bottom: .625rem;
    display: flex;
    flex-direction: column;
    gap: .125rem;
    font-family: var(--fr-mono);
    font-size: .6875rem;
    color: rgba(188, 231, 255, .72);
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}

.jx-fr-tip {
    position: absolute;
    z-index: 3;
    min-width: 170px;
    max-width: 260px;
    padding: .5rem .625rem;
    border: 0.5px solid rgba(94, 214, 255, .3);
    border-radius: var(--radius, 10px);
    background: rgba(4, 12, 20, .94);
    color: #e6f5ff;
    font-size: .75rem;
    line-height: 1.5;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
.jx-fr-tip b { font-family: var(--fr-mono); font-weight: 600; }
.jx-fr-tip i { color: rgba(188, 231, 255, .72); font-style: normal; }

/* ── 右侧栏 ─────────────────────────────────────────────────────────── */
.jx-fr-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.jx-fr-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .625rem;
}
.jx-fr-stat {
    display: flex;
    flex-direction: column;
    gap: .125rem;
    padding: .75rem .8125rem;
    border: 0.5px solid var(--border);
    border-radius: var(--radius, 10px);
    background: var(--surface-primary);
}
.jx-fr-stat__num {
    font-family: var(--fr-mono);
    font-size: 1.375rem;
    font-weight: 600;
    line-height: 1.1;
    color: var(--text);
}
.jx-fr-stat__label { font-size: .6875rem; color: var(--text-secondary); }

.jx-fr-block {
    padding: .875rem;
    border: 0.5px solid var(--border);
    border-radius: var(--radius-xl, 18px);
    background: var(--surface-primary);
}
.jx-fr-block__title {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0 0 .5rem;
    font-size: .9375rem;
    font-weight: 600;
    color: var(--text);
}
.jx-fr-block__hint {
    margin: 0 0 .625rem;
    font-size: .75rem;
    line-height: 1.55;
    color: var(--text-secondary);
}
.jx-fr-count {
    padding: .0625rem .4375rem;
    border-radius: var(--radius-full, 999px);
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--fr-mono);
    font-size: .75rem;
}

.jx-fr-events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; max-height: 320px; overflow-y: auto; }
.jx-fr-event {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .5rem .625rem;
    padding: .5rem .625rem;
    border: 0.5px solid var(--border-light);
    border-left-width: 3px;
    border-radius: var(--radius, 10px);
    background: var(--surface-secondary, var(--surface-primary));
}
.jx-fr-event--takeoff { border-left-color: var(--fr-phase-departure); }
.jx-fr-event--landing { border-left-color: var(--fr-phase-approach); }
.jx-fr-event__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 50%;
    font-size: .75rem;
    font-weight: 700;
    background: var(--ios-fill-quaternary, rgba(120, 120, 128, 0.12));
}
.jx-fr-event--takeoff .jx-fr-event__icon { color: var(--fr-phase-departure); }
.jx-fr-event--landing .jx-fr-event__icon { color: var(--fr-phase-approach); }
.jx-fr-event__call { font-family: var(--fr-mono); font-weight: 600; font-size: .8125rem; color: var(--text); }
.jx-fr-event__sub { display: block; font-size: .6875rem; color: var(--text-secondary); }
.jx-fr-event__meta { grid-column: 2; font-size: .6875rem; color: var(--text-secondary); }
.jx-fr-event__time { grid-column: 2; font-family: var(--fr-mono); font-size: .6875rem; color: var(--text-secondary); }

.jx-fr-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .375rem .625rem; }
.jx-fr-legend__item { display: flex; align-items: center; gap: .375rem; font-size: .75rem; color: var(--text-secondary); }
.jx-fr-legend__dot { width: .5rem; height: .5rem; border-radius: 50%; flex: none; }

/* 阶段色（图例与列表共用） */
[data-phase="departure"] { background-color: var(--fr-phase-departure); }
[data-phase="climb"] { background-color: var(--fr-phase-climb); }
[data-phase="cruise"] { background-color: var(--fr-phase-cruise); }
[data-phase="low"] { background-color: var(--fr-phase-low); }
[data-phase="descent"] { background-color: var(--fr-phase-descent); }
[data-phase="approach"] { background-color: var(--fr-phase-approach); }
[data-phase="ground"] { background-color: var(--fr-phase-ground); }

/* ── 目标列表 ───────────────────────────────────────────────────────── */
.jx-fr-list-wrap { margin-top: 1.75rem; }

.jx-fr-list { display: flex; flex-direction: column; gap: .375rem; }

.jx-fr-plane {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) repeat(6, minmax(0, .95fr));
    gap: .5rem;
    align-items: center;
    width: 100%;
    padding: .5rem .75rem;
    border: 0.5px solid var(--border);
    border-radius: var(--radius, 10px);
    background: var(--surface-primary);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: border-color var(--transition), background-color var(--transition);
}
.jx-fr-plane:hover { border-color: var(--accent); }
.jx-fr-plane:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.jx-fr-plane.is-selected { border-color: var(--accent); background: var(--accent-soft); }

.jx-fr-plane__id { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .5rem; min-width: 0; }
.jx-fr-plane__dot { width: .5rem; height: .5rem; border-radius: 50%; flex: none; }
.jx-fr-plane__call {
    font-family: var(--fr-mono);
    font-size: .8125rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.jx-fr-plane__sub {
    grid-column: 2;
    font-size: .6875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.jx-fr-plane__cell { display: flex; flex-direction: column; min-width: 0; }
.jx-fr-plane__cell b { font-family: var(--fr-mono); font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.jx-fr-plane__cell i { font-size: .6875rem; font-style: normal; color: var(--text-secondary); white-space: nowrap; }

.jx-fr-empty {
    margin: .625rem 0 0;
    padding: .875rem;
    border: 0.5px dashed var(--border);
    border-radius: var(--radius, 10px);
    font-size: .8125rem;
    line-height: 1.7;
    color: var(--text-secondary);
}
.jx-fr-empty--sm { padding: .5rem .625rem; margin-top: .5rem; }
.jx-fr-empty[hidden] { display: none; }

/* ── 数据说明 ───────────────────────────────────────────────────────── */
.jx-fr-note {
    margin-top: 1.75rem;
    padding: 1rem 1.125rem;
    border: 0.5px solid var(--border);
    border-radius: var(--radius-xl, 18px);
    background: var(--surface-secondary, var(--surface-primary));
}
.jx-fr-note ul { margin: 0; padding-left: 1.1rem; }
.jx-fr-note li { margin: .3125rem 0; font-size: .8125rem; line-height: 1.7; color: var(--text-secondary); }
.jx-fr-note a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ── 响应式 ─────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .jx-fr-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .jx-fr-grid { grid-template-columns: minmax(0, 1fr); }
    .jx-fr-side { flex-direction: row; flex-wrap: wrap; }
    .jx-fr-side > * { flex: 1 1 260px; }
}

@media (max-width: 760px) {
    .jx-fr-bar { grid-template-columns: minmax(0, 1fr); }
    .jx-fr-side { flex-direction: column; }
    .jx-fr-plane {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .5rem .75rem;
    }
    .jx-fr-plane__id { grid-column: 1 / -1; }
    .jx-fr-plane__cell { padding-top: .25rem; }
    .jx-fr-plane__cell:nth-child(odd) { border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .jx-fr-hero__dot { animation: none; }
    .jx-fr-spinner { animation-duration: 2s; }
}
