/* Base
-------------------------------------------------- */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #222;
    background: #fff;
}

textarea {
    width: 100%;
    min-height: 220px;
    padding: 12px;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
}

select,
button {
    padding: 8px 12px;
    margin-top: 10px;
}

button {
    cursor: pointer;
}

button:disabled {
    opacity: 0.6;
    cursor: wait;
}

pre {
    padding: 20px;
    overflow-x: auto;
    background: #f4f4f4;
}

.error {
    color: #a00;
}


/* Site header
-------------------------------------------------- */

.site-header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
}

.site-header__inner {
    width: min(1160px, calc(100% - 48px));
    height: 92px;
    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
}


.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #171717;
    text-decoration: none;
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1;
}

.site-brand img {
    display: block;
    width: 54px;
    height: 54px;
}

.site-module {
    color: #2f7d48;
    font-size: 1.55rem;
    font-weight: 600;
}

/* Main content
-------------------------------------------------- */

.site-main {
    width: min(1160px, calc(100% - 48px));
    margin: 0 auto;
    padding: 48px 0 64px;
}



/* Loading
-------------------------------------------------- */

.loading {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    font-weight: 600;
}

.loading.is-visible {
    display: flex;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid #ddd;
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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


/* Analysis results
-------------------------------------------------- */

.analysis-result {
    margin-top: 32px;
}

.analysis-time {
    margin: 0 0 12px;
    font-weight: 600;
}

.analysis-result h2 {
    margin: 0 0 20px;
}


/* Summary
-------------------------------------------------- */

.analysis-summary {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 32px;
    margin-bottom: 28px;
    padding: 18px 20px;
    background: #f4f4f4;
    border: 1px solid #ddd;
}

.analysis-summary strong {
    display: inline-block;
    margin-bottom: 4px;
}


/* Results table
-------------------------------------------------- */

.results-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.results-table th,
.results-table td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #ddd;
}

.results-table th {
    font-size: 0.9rem;
    font-weight: 600;
    background: #f4f4f4;
    white-space: nowrap;
}

.results-table tbody > tr:not(.result-detail-row):hover {
    background: #fafafa;
}

.results-table td:nth-child(1),
.results-table td:nth-child(5),
.results-table td:nth-child(6) {
    white-space: nowrap;
}

.results-table a {
    color: inherit;
}


/* Hit details
-------------------------------------------------- */

.result-detail-row > td {
    padding: 0;
    border-bottom: 0;
}

.result-detail {
    margin: 0 0 12px;
    border-bottom: 1px solid #ddd;
}

.result-detail summary {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.9rem;
}

.result-detail summary:hover {
    background: #fafafa;
}

.result-detail-content {
    padding: 16px 20px 24px;
}

.result-detail-content h3 {
    margin: 28px 0 12px;
    font-size: 1rem;
}


/* Hit metrics
-------------------------------------------------- */

.hit-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px 24px;
    margin: 0;
}

.hit-metrics div {
    min-width: 0;
}

.hit-metrics dt {
    margin-bottom: 3px;
    font-size: 0.8rem;
    color: #666;
}

.hit-metrics dd {
    margin: 0;
    font-weight: 600;
}


/* Taxonomy
-------------------------------------------------- */

.taxonomy {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px 24px;
    margin: 0;
}

.taxonomy div {
    min-width: 0;
}

.taxonomy dt {
    margin-bottom: 2px;
    font-size: 0.8rem;
    color: #666;
}

.taxonomy dd {
    margin: 0;
}


/* Sequence alignment
-------------------------------------------------- */

.alignment {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre;
    background: #f4f4f4;
    border: 1px solid #ddd;
}


/* Raw JSON
-------------------------------------------------- */

.raw-json {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid #ddd;
}

.raw-json summary {
    cursor: pointer;
    font-weight: 600;
}

.raw-json pre {
    margin-top: 14px;
}


/* Responsive
-------------------------------------------------- */

@media (max-width: 700px) {

    .site-header__inner {
        width: min(100% - 32px, 1160px);
        height: 76px;
    }

    .site-header__logo {
        width: 175px;
        height: 48px;
    }

    .site-header__module {
        font-size: 0.85rem;
    }

    .site-main {
        width: min(100% - 32px, 1160px);
        padding-top: 32px;
    }

    .analysis-summary {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .results-table th,
    .results-table td {
        padding: 10px;
    }

    .hit-metrics,
    .taxonomy {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {

    .hit-metrics,
    .taxonomy {
        grid-template-columns: 1fr;
    }
}