/* -------------------------------------------------- */
/* Root / Theme */
/* -------------------------------------------------- */
:root {
    --bg: #0b1020;
    --bg-soft: #121933;
    --panel: #151d3a;
    --panel-2: #1b2547;
    --border: rgba(255, 255, 255, 0.08);
    --text: #eef2ff;
    --text-soft: #b9c2e3;
    --text-muted: #8d98bf;
    --primary: #7c9cff;
    --primary-hover: #96b0ff;
    --secondary: #263154;
    --secondary-hover: #31406d;
    --success: #28c281;
    --warning: #ffb648;
    --danger: #ff6b6b;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --max-width: 1440px;
    --transition: 180ms ease;
    --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
}

/* -------------------------------------------------- */
/* Reset */
/* -------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    background:
        radial-gradient(circle at top left, rgba(124, 156, 255, 0.14), transparent 28%),
        radial-gradient(circle at top right, rgba(40, 194, 129, 0.08), transparent 20%),
        linear-gradient(180deg, #0a0f1d 0%, #0f1630 100%);
    color: var(--text);
}

button,
input,
select,
textarea {
    font: inherit;
}

/* -------------------------------------------------- */
/* Layout */
/* -------------------------------------------------- */
.app-shell {
    width: min(var(--max-width), calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 48px;
}

.layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1100px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

/* -------------------------------------------------- */
/* Hero */
/* -------------------------------------------------- */
.hero {
    margin-bottom: 24px;
    border: 1px solid var(--border);
    background:
        linear-gradient(135deg, rgba(124, 156, 255, 0.12), rgba(255, 255, 255, 0.02)),
        var(--panel);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.hero__content {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 30px;
}

@media (max-width: 900px) {
    .hero__content {
        flex-direction: column;
    }
}

.hero__eyebrow {
    margin: 0 0 10px;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero__title {
    margin: 0 0 12px;
    font-size: clamp(1.9rem, 2.8vw, 3rem);
    line-height: 1.05;
}

.hero__subtitle {
    margin: 0;
    max-width: 760px;
    color: var(--text-soft);
    line-height: 1.65;
    font-size: 1rem;
}

.hero__right {
    display: grid;
    grid-template-columns: repeat(3, minmax(140px, 1fr));
    gap: 14px;
    min-width: min(100%, 460px);
}

@media (max-width: 900px) {
    .hero__right {
        grid-template-columns: 1fr;
        min-width: 100%;
    }
}

.hero-stat {
    padding: 16px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
}

.hero-stat__label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.hero-stat__value {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
}

/* -------------------------------------------------- */
/* Panels */
/* -------------------------------------------------- */
.panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    box-shadow: var(--shadow);
    padding: 24px;
}

.panel__header {
    margin-bottom: 22px;
}

.panel__header h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
}

.panel__header p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.6;
}

/* -------------------------------------------------- */
/* Forms */
/* -------------------------------------------------- */
.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: inline-block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text);
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.selection-info {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.helper-text {
    margin: 10px 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition),
        background var(--transition);
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

textarea {
    min-height: 180px;
    resize: vertical;
    padding: 14px 16px;
    line-height: 1.6;
}

select {
    padding: 11px 12px;
    appearance: none;
}

textarea:focus,
select:focus {
    border-color: rgba(124, 156, 255, 0.6);
    box-shadow: 0 0 0 4px rgba(124, 156, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
}

textarea::placeholder {
    color: var(--text-muted);
}

/* -------------------------------------------------- */
/* Toolbars */
/* -------------------------------------------------- */
.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.button-group--compact {
    gap: 10px;
}

.mini-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mini-toolbar__label {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.92rem;
    font-weight: 600;
}

.mini-select {
    min-width: 180px;
}

/* -------------------------------------------------- */
/* Buttons */
/* -------------------------------------------------- */
button {
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 11px 16px;
    cursor: pointer;
    transition:
        transform var(--transition),
        background var(--transition),
        border-color var(--transition),
        color var(--transition),
        opacity var(--transition);
    font-weight: 600;
}

button:hover {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

button:not(.button-secondary) {
    background: var(--primary);
    color: #071126;
}

button:not(.button-secondary):hover {
    background: var(--primary-hover);
}

.button-secondary {
    background: var(--secondary);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.06);
}

.button-secondary:hover {
    background: var(--secondary-hover);
}

/* -------------------------------------------------- */
/* Checkbox List */
/* -------------------------------------------------- */
.checkbox-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.checkbox-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    transition: border-color var(--transition), background var(--transition);
    cursor: pointer;
}

.checkbox-card:hover {
    border-color: rgba(124, 156, 255, 0.35);
    background: rgba(255, 255, 255, 0.05);
}

.checkbox-card input {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    margin: 0;
}

.checkbox-card span {
    color: var(--text);
    font-weight: 500;
}

/* -------------------------------------------------- */
/* Status / Insight / Empty States */
/* -------------------------------------------------- */
.status-box,
.insight-box,
.empty-state {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    line-height: 1.6;
}

.status-box {
    margin-top: 18px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
}

.status-box[data-state="success"] {
    border-color: rgba(40, 194, 129, 0.35);
    background: rgba(40, 194, 129, 0.10);
    color: #d5fff0;
}

.status-box[data-state="error"] {
    border-color: rgba(255, 107, 107, 0.35);
    background: rgba(255, 107, 107, 0.10);
    color: #ffe1e1;
}

.status-box[data-state="info"] {
    border-color: rgba(124, 156, 255, 0.35);
    background: rgba(124, 156, 255, 0.10);
    color: #e1e9ff;
}

.insight-box {
    margin-bottom: 18px;
    background: linear-gradient(135deg, rgba(124, 156, 255, 0.12), rgba(255, 255, 255, 0.03));
    color: var(--text-soft);
}

.empty-state {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    text-align: center;
}

/* -------------------------------------------------- */
/* Summary */
/* -------------------------------------------------- */
.compare-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

@media (max-width: 900px) {
    .compare-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .compare-summary {
        grid-template-columns: 1fr;
    }
}

.summary-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
}

.summary-card__label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.84rem;
}

.summary-card strong {
    font-size: 1.12rem;
}

/* -------------------------------------------------- */
/* Results Toolbar */
/* -------------------------------------------------- */
.results-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

/* -------------------------------------------------- */
/* Results */
/* -------------------------------------------------- */
.results-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 22px;
}

.result-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
    padding: 18px;
}

.result-card__header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.result-card__header h3 {
    margin: 0;
    font-size: 1.08rem;
}

.result-card__meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--text-soft);
    font-size: 0.88rem;
}

.result-card__meta span {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(124, 156, 255, 0.12);
    color: #dbe5ff;
}

.result-card__body {
    color: var(--text-soft);
}

.result-card__tokens {
    margin: 0;
    line-height: 1.7;
    word-break: break-word;
}

/* -------------------------------------------------- */
/* Detail Sections */
/* -------------------------------------------------- */
.detail-section {
    margin-top: 22px;
}

.detail-section__title {
    margin: 0 0 12px;
    font-size: 1.05rem;
}

.detail-section__body {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
}

/* -------------------------------------------------- */
/* Highlights */
/* -------------------------------------------------- */
.highlight-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

@media (max-width: 900px) {
    .highlight-grid {
        grid-template-columns: 1fr;
    }
}

.highlight-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
}

.highlight-card__label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.84rem;
}

.highlight-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 1.05rem;
}

.highlight-card p {
    margin: 0;
    color: var(--text-soft);
}

/* -------------------------------------------------- */
/* Table */
/* -------------------------------------------------- */
.table-wrapper {
    overflow-x: auto;
}

.metrics-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.metrics-table th,
.metrics-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.95rem;
}

.metrics-table th {
    position: sticky;
    top: 0;
    background: #1a2343;
    color: var(--text);
    font-weight: 700;
}

.metrics-table td {
    color: var(--text-soft);
}

.metrics-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* -------------------------------------------------- */
/* Pairwise */
/* -------------------------------------------------- */
.pairwise-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
    margin-bottom: 12px;
}

.pairwise-card:last-child {
    margin-bottom: 0;
}

.pairwise-card h4 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.pairwise-card p {
    margin: 8px 0 0;
    color: var(--text-soft);
    line-height: 1.6;
    word-break: break-word;
}

/* -------------------------------------------------- */
/* Small Screens */
/* -------------------------------------------------- */
@media (max-width: 640px) {
    .app-shell {
        width: min(100% - 20px, var(--max-width));
        padding-top: 20px;
    }

    .panel {
        padding: 18px;
    }

    .hero__content {
        padding: 22px;
    }

    .result-card__header {
        flex-direction: column;
    }

    .results-toolbar,
    .toolbar-row,
    .button-group {
        align-items: stretch;
    }

    .results-toolbar > * ,
    .toolbar-row > * ,
    .button-group > * {
        width: 100%;
    }

    .mini-toolbar {
        width: 100%;
    }

    .mini-select {
        width: 100%;
        min-width: 0;
    }
}