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

/* ── Base ──────────────────────────────────────────── */
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: #1a1a1a; background: #f5f5f5; }

/* ── Header ────────────────────────────────────────── */
header { display: flex; align-items: center; height: 48px; padding: 0 16px; background: #fff; border-bottom: 1px solid #e0e0e0; }
header h1 { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
header nav { margin-left: auto; display: flex; gap: 16px; }
header nav a { font-size: 13px; font-weight: 500; color: #555; text-decoration: none; }
header nav a:hover { color: #1a1a1a; }

/* ── Modal ─────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,0.35); display: none; align-items: center; justify-content: center; }
.modal-overlay.visible { display: flex; }
.modal { background: #fff; border-radius: 10px; padding: 28px 32px; max-width: 480px; width: 90%; position: relative; box-shadow: 0 8px 30px rgba(0,0,0,0.18); }
.modal h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.modal p { font-size: 13px; line-height: 1.6; color: #333; margin-bottom: 10px; }
.modal pre { font-family: "SF Mono", "Fira Code", "Consolas", monospace; font-size: 12px; background: #f5f5f5; border: 1px solid #e0e0e0; border-radius: 4px; padding: 8px 12px; margin-bottom: 10px; }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 22px; color: #999; cursor: pointer; padding: 0; line-height: 1; }
.modal-close:hover { color: #333; }

/* ── App layout ────────────────────────────────────── */
#app { display: flex; height: calc(100% - 48px); }

/* ── Sidebar ───────────────────────────────────────── */
#sidebar { width: 320px; min-width: 280px; padding: 16px; background: #fff; border-right: 1px solid #e0e0e0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }

label[for="flight-input"] { font-size: 13px; font-weight: 500; color: #555; }

#flight-input { width: 100%; height: 160px; padding: 10px; font-family: "SF Mono", "Fira Code", "Consolas", monospace; font-size: 13px; line-height: 1.5; border: 1px solid #d0d0d0; border-radius: 6px; resize: vertical; background: #fafafa; }
#flight-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }

.input-actions { display: flex; gap: 8px; }

button, #upload-label { display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; font-size: 13px; font-weight: 500; border: 1px solid transparent; border-radius: 6px; cursor: pointer; transition: background 0.15s, border-color 0.15s; }

#plot-btn { background: #2563eb; color: #fff; flex: 1; }
#plot-btn:hover { background: #1d4ed8; }

.secondary { background: #f0f0f0; color: #333; border-color: #d0d0d0; }
.secondary:hover { background: #e5e5e5; }

#upload-label { position: relative; }
#upload-label input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

#export-btn { width: 100%; background: #f0f0f0; color: #333; border-color: #d0d0d0; }
#export-btn:hover:not(:disabled) { background: #e5e5e5; }
button:disabled { opacity: 0.4; cursor: default; }
#plot-btn:disabled { background: #93b4f4; }

/* ── Style picker ──────────────────────────────────── */
.style-section label { font-size: 13px; font-weight: 500; color: #555; }
#style-picker { width: 100%; padding: 6px 10px; font-size: 13px; border: 1px solid #d0d0d0; border-radius: 6px; background: #fafafa; margin-top: 4px; }

/* ── Status / flight list ──────────────────────────── */
#status { font-size: 13px; color: #555; min-height: 20px; }
#status.error { color: #dc2626; }
#status.success { color: #16a34a; }

#flight-list { display: flex; flex-direction: column; gap: 4px; font-size: 13px; flex: 1; overflow-y: auto; }
.flight-item { display: flex; justify-content: space-between; padding: 6px 8px; border-radius: 4px; background: #f9fafb; border: 1px solid #eee; }
.flight-item .codes { font-family: "SF Mono", "Fira Code", "Consolas", monospace; font-weight: 500; }
.flight-item .distance { color: #888; font-size: 12px; }
.flight-item.invalid { border-color: #fca5a5; background: #fef2f2; color: #dc2626; }

/* ── Map ───────────────────────────────────────────── */
main { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }

/* ── Ad slot ───────────────────────────────────────── */
.ad-slot { min-height: 0; }
.ad-slot:empty { display: none; }

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  #app { flex-direction: column; }
  #sidebar { width: 100%; height: auto; max-height: 40vh; border-right: none; border-bottom: 1px solid #e0e0e0; }
}
