/* ── Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: #0d1117;
    color: #e6edf3;
    margin: 0;
    line-height: 1.6;
}

a, .btn-link { color: #58a6ff; }
a:hover { color: #79b8ff; }

h1, h2, h3, h4 { color: #e6edf3; font-weight: 600; }

code { color: #ff7b72; }

/* ── Blazor loading / error ───────────────────────────────── */
#blazor-error-ui {
    color-scheme: dark;
    background: #1c2128;
    border-top: 1px solid #f85149;
    color: #e6edf3;
    bottom: 0;
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #1c2128;
    border: 1px solid #f85149;
    border-radius: 8px;
    padding: 1rem 1rem 1rem 3.7rem;
    color: #f85149;
}

.blazor-error-boundary::after { content: "An error has occurred." }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #30363d;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #58a6ff;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
    color: #8b949e;
}

.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Loading"); }

/* ── Form floats (Blazor default, kept for compat) ───────── */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: #8b949e;
    text-align: end;
}
.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ── Query page ───────────────────────────────────────────── */
.query-container {
    max-width: 680px;
    margin: 2.5rem auto;
    padding: 0 1.25rem;
}

.query-container h2 {
    font-size: 1.4rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #8b949e;
    margin-bottom: 1rem;
}

.query-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.state-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8b949e;
}

.query-form select,
.query-form input {
    background: #161b22;
    color: #e6edf3;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font-size: 0.95rem;
    transition: border-color 0.15s;
}

.query-form select:focus,
.query-form input:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}

.query-form input {
    flex: 1;
    min-width: 180px;
}

.query-form button {
    padding: 0.55rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    background: #238636;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.query-form button:hover:not(:disabled) { background: #2ea043; }
.query-form button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Result card ──────────────────────────────────────────── */
.result {
    margin-top: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    border: 1px solid #30363d;
    background: #161b22;
}

.result.found  { border-color: #3fb95066; }
.result.not-found { border-color: #30363d; background: #13171e; }
.result.negative { border-color: #f8514966; }

.result-status { font-weight: 600; color: #8b949e; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.25rem; }
.result-message { margin: 0.5rem 0; color: #cdd5df; }

/* ── Status badges ────────────────────────────────────────── */
.status-badge {
    display: inline-block;
    font-size: 1.3rem;
    font-weight: 700;
    padding: 0.3em 1em;
    border-radius: 999px;
    margin: 0.4rem 0 0.8rem 0;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-confirmed  { background: #1a4731; color: #3fb950; border: 1px solid #3fb95066; }
.status-suspected  { background: #2d2008; color: #d29922; border: 1px solid #d2992266; }
.status-redherring { background: #2d0f0f; color: #f85149; border: 1px solid #f8514966; }

/* ── Last sighting panel ──────────────────────────────────── */
.last-sighting {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #cdd5df;
}

.last-sighting h4 {
    margin: 0 0 0.6rem 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8b949e;
}

.last-sighting p { margin: 0.2rem 0; }

/* ── Match list ───────────────────────────────────────────── */
.match-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0;
    border: 1px solid #30363d;
    border-radius: 8px;
    overflow: hidden;
}

.match-list li {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #30363d;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: #cdd5df;
}

.match-list li:last-child { border-bottom: none; }

.match-list .status-badge {
    font-size: 0.7rem;
    padding: 0.15em 0.6em;
    margin: 0;
}

.match-list button {
    margin-left: auto;
    padding: 0.25rem 0.75rem;
    background: #21262d;
    color: #58a6ff;
    border: 1px solid #30363d;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s, border-color 0.15s;
}

.match-list button:hover { background: #30363d; border-color: #58a6ff; }

/* ── Sighting form ────────────────────────────────────────── */
.sighting-form {
    margin-top: 1.25rem;
    padding: 1.25rem;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.sighting-form h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8b949e;
}

.sighting-form input,
.sighting-form label input {
    background: #161b22;
    color: #e6edf3;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    width: 100%;
    transition: border-color 0.15s;
}

.sighting-form input:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}

.sighting-form input::placeholder { color: #484f58; }

.sighting-form label {
    font-size: 0.8rem;
    color: #8b949e;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.sighting-form button {
    align-self: flex-start;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: #1f6feb;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.sighting-form button:hover:not(:disabled) { background: #388bfd; }
.sighting-form button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Misc ─────────────────────────────────────────────────── */
.btn-confirm {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.5rem 1.2rem;
    background: #1f6feb;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s;
}

.btn-confirm:hover { background: #388bfd; }

.confirmation {
    margin-top: 0.75rem;
    padding: 0.6rem 1rem;
    background: #1a4731;
    border: 1px solid #3fb95066;
    border-radius: 8px;
    color: #3fb950;
    font-weight: 600;
    font-size: 0.9rem;
}

.error {
    padding: 0.6rem 1rem;
    background: #2d0f0f;
    border: 1px solid #f8514966;
    border-radius: 8px;
    color: #f85149;
    font-size: 0.9rem;
}

.status {
    color: #8b949e;
    font-style: italic;
    font-size: 0.9rem;
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 640.98px) {
    .query-container {
        margin: 1.25rem auto;
    }

    /* Stack form fields vertically */
    .query-form {
        flex-direction: column;
    }

    .state-label {
        width: 100%;
    }

    .query-form select,
    .query-form input,
    .query-form button {
        width: 100%;
        min-height: 2.75rem; /* larger touch target */
        font-size: 1rem;
    }

    /* Slightly smaller badge on mobile */
    .status-badge {
        font-size: 1.1rem;
    }

    /* Match list: wrap the Select button to its own row */
    .match-list li {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .match-list button {
        margin-left: 0;
        width: 100%;
        text-align: center;
        min-height: 2.5rem;
    }

    /* Sighting form full-width submit */
    .sighting-form button,
    .btn-confirm {
        width: 100%;
        text-align: center;
        min-height: 2.75rem;
    }

    /* Input sizing */
    .sighting-form input,
    .sighting-form label input {
        font-size: 1rem;
        min-height: 2.75rem;
    }
}
