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

:root {
    --blue: #4f8ef7;
    --blue-dark: #2563eb;
    --blue-light: #eff6ff;
    --bg: #f0f4f8;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-hint: #94a3b8;
    --red: #e24b4a;
    --red-light: #fff1f1;
    --green: #16a34a;
    --green-light: #f0fdf4;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.07), 0 1px 4px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 48px 16px 48px;
    color: var(--text);
}

.container {
    background: var(--surface);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 560px;
    padding: 32px 28px 24px;
    animation: fadeUp 0.4s ease;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--blue-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.3px;
}

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

/* ── Input Row ───────────────────────────────────────────────────────────── */
.input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

input[type="text"] {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    height: 40px;
}

input[type="text"]::placeholder {
    color: var(--text-hint);
}

input[type="text"]:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.15);
}

/* ── Button ──────────────────────────────────────────────────────────────── */
button {
    height: 40px;
    padding: 0 20px;
    background: var(--blue);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

button:hover {
    background: var(--blue-dark);
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ── Error Box ───────────────────────────────────────────────────────────── */
.error-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--red-light);
    border: 1px solid #fca5a5;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13px;
    color: var(--red);
    margin-bottom: 16px;
}

/* ── Section Title ───────────────────────────────────────────────────────── */
.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.badge {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 100px;
    background: var(--green-light);
    color: var(--green);
    letter-spacing: 0.3px;
}

/* ── Info Cards ──────────────────────────────────────────────────────────── */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 14px 12px;
}

.card-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-hint);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-value {
    font-size: 13.5px;
    color: var(--text);
    word-break: break-all;
    line-height: 1.45;
}

.card-value.mono {
    font-family: 'Consolas', 'SF Mono', monospace;
    font-size: 12.5px;
}

.card.wide {
    grid-column: 1 / -1;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.tag {
    font-size: 12px;
    padding: 3px 8px;
    background: var(--blue-light);
    color: var(--blue-dark);
    border-radius: 4px;
    font-family: 'Consolas', monospace;
}

/* ── Map Section ─────────────────────────────────────────────────────────── */
.map-section {
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-2);
}

.map-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-hint);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

#leafletMap {
    height: 220px;
    width: 100%;
}

/* Leaflet attribution tweak */
.leaflet-control-attribution {
    font-size: 10px !important;
}

.map-loader {
    height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.map-loader-spin {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.map-error {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--red);
    padding: 12px;
    text-align: center;
}

/* ── Raw Toggle ──────────────────────────────────────────────────────────── */
.raw-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    margin-bottom: 8px;
    width: fit-content;
    padding: 4px 0;
    transition: color 0.15s;
}

.raw-toggle:hover {
    color: var(--text);
}

#rawArrow {
    transition: transform 0.2s;
}

#rawArrow.open {
    transform: rotate(180deg);
}

pre {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 12px;
    font-family: 'Consolas', 'SF Mono', monospace;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 280px;
    overflow-y: auto;
    line-height: 1.6;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
    font-size: 12px;
    color: var(--text-hint);
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 420px) {
    .container {
        padding: 24px 18px 20px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .card.wide {
        grid-column: auto;
    }
}