/* ===== SYNTHESIZE PAGE ===== */

/* ─── Header ──────────────────────────────────────────────── */
.synth-header {
    max-width: 860px;
    margin: 0 auto;
    padding: 56px 24px 24px;
    text-align: center;
}

.synth-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #ef8354;
    background: rgba(239, 131, 84, 0.1);
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 18px;
}
.synth-badge i, .synth-badge svg { width: 15px; height: 15px; }

.synth-header h1 {
    font-size: 2.6rem;
    color: #2b2d42;
    line-height: 1.1;
    margin-bottom: 12px;
}

.synth-header > p {
    font-size: 1.08rem;
    color: #555;
    max-width: 660px;
    margin: 0 auto 28px;
}

/* ─── Search bar (matches the homepage .search-bar look) ──── */
.synth-search-bar {
    display: flex;
    align-items: stretch;
    gap: 0;
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
}
.synth-search-bar input {
    flex: 1;
    min-width: 0;
    padding: 16px 22px;
    font-size: 1rem;
    line-height: 1.5;
    font-family: 'Source Sans 3', sans-serif;
    color: #1a1a2e;
    background: #fff;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-right: none;
    border-radius: 12px 0 0 12px;
    outline: none;
    transition: border-color 0.25s, background 0.25s;
}
.synth-search-bar input::placeholder { color: #9a9aa4; }
.synth-search-bar:focus-within input {
    border-color: rgba(239, 131, 84, 0.5);
}
.synth-search-bar .btn-search {
    flex-shrink: 0;
    padding: 16px 32px;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #ef8354, #e06e3a);
    color: #fff;
    border: none;
    border-radius: 0 12px 12px 0;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.synth-search-bar .btn-search:hover { background: linear-gradient(135deg, #e06e3a, #c85c2e); }
.synth-search-bar .btn-search:disabled { opacity: 0.6; cursor: default; }

/* Note: .mode-toggle / .mode-btn styles live in styles.css so the
   segmented control can be reused on index.html and browse.html too. */
.synth-header .mode-toggle {
    margin-top: 12px;
}

/* ─── Example chips ───────────────────────────────────────── */
.synth-examples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 22px;
    font-size: 0.9rem;
    color: #888;
}
.synth-example {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 0.85rem;
    color: #444;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.synth-example:hover { border-color: #ef8354; color: #ef8354; }

/* ─── Main ────────────────────────────────────────────────── */
.synth-main {
    max-width: 940px;
    margin: 0 auto;
    padding: 20px 24px 80px;
}

/* ─── Login gate ──────────────────────────────────────────── */
.synth-gate {
    text-align: center;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 18px;
    padding: 48px 28px;
    max-width: 480px;
    margin: 30px auto;
}
.synth-gate i, .synth-gate svg { width: 40px; height: 40px; color: #ef8354; margin-bottom: 8px; }
.synth-gate h2 { font-size: 1.5rem; color: #2b2d42; margin-bottom: 8px; }
.synth-gate p { color: #666; margin-bottom: 22px; }
.synth-gate-actions { display: flex; gap: 14px; align-items: center; justify-content: center; }
.synth-gate .btn-search {
    background: #ef8354; color: #fff; border: none; border-radius: 11px;
    padding: 12px 22px; font-weight: 700; cursor: pointer;
}
.synth-gate .btn-search:hover { background: #e06b3a; }
.synth-gate-login { color: #ef8354; font-weight: 600; }

/* ─── Progress ────────────────────────────────────────────── */
.synth-progress {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 16px;
    padding: 28px;
    max-width: 560px;
    margin: 30px auto;
}
.synth-spinner {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border: 3px solid rgba(239, 131, 84, 0.25);
    border-top-color: #ef8354;
    border-radius: 50%;
    animation: synthspin 0.8s linear infinite;
    margin-top: 2px;
}
@keyframes synthspin { to { transform: rotate(360deg); } }
.synth-progress-title { font-weight: 700; color: #2b2d42; margin-bottom: 12px; font-size: 1.05rem; }
.synth-steps { list-style: none; padding: 0; margin: 0; }
.synth-steps .step {
    display: flex; align-items: center; gap: 10px;
    color: #999; font-size: 0.95rem; padding: 5px 0;
    transition: color 0.2s;
}
.synth-steps .step-dot { font-size: 0.9rem; width: 16px; text-align: center; }
.synth-steps .step-active { color: #ef8354; font-weight: 600; }
.synth-steps .step-done { color: #2b2d42; }

/* ─── Error ───────────────────────────────────────────────── */
.synth-error {
    text-align: center;
    background: #fff;
    border: 1px solid rgba(214, 69, 65, 0.25);
    border-radius: 16px;
    padding: 34px 28px;
    max-width: 520px;
    margin: 30px auto;
}
.synth-error i, .synth-error svg { width: 34px; height: 34px; color: #d64541; margin-bottom: 6px; }
.synth-error p { color: #555; margin-bottom: 18px; }
.btn-retry {
    background: #ef8354; color: #fff; border: none; border-radius: 10px;
    padding: 10px 20px; font-weight: 700; cursor: pointer;
}
.btn-retry:hover { background: #e06b3a; }

/* ─── Report ──────────────────────────────────────────────── */
.synth-report { animation: fadeInUp 0.4s ease; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.report-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 16px; margin-bottom: 20px;
    padding-bottom: 18px; border-bottom: 2px solid rgba(0, 0, 0, 0.06);
}
.report-question { font-size: 1.6rem; color: #2b2d42; line-height: 1.25; }
.report-actions { display: flex; gap: 8px; flex-shrink: 0; }
.report-action {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 9px; padding: 8px 14px; font-size: 0.88rem; font-weight: 600;
    color: #444; cursor: pointer; transition: border-color 0.2s, color 0.2s;
}
.report-action i, .report-action svg { width: 15px; height: 15px; }
.report-action:hover { border-color: #ef8354; color: #ef8354; }

.report-tldr {
    background: linear-gradient(135deg, rgba(239, 131, 84, 0.08), rgba(239, 131, 84, 0.02));
    border: 1px solid rgba(239, 131, 84, 0.2);
    border-radius: 14px; padding: 20px 22px; margin-bottom: 30px;
}
.tldr-label {
    display: inline-block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em;
    text-transform: uppercase; color: #ef8354; margin-bottom: 8px;
}
.report-tldr p { font-size: 1.12rem; color: #2b2d42; line-height: 1.55; margin: 0; }

.report-block { margin-bottom: 34px; }
.report-block > h3 {
    display: flex; align-items: center; gap: 8px;
    font-size: 1.18rem; color: #2b2d42; margin-bottom: 12px;
}
.report-block > h3 i, .report-block > h3 svg { width: 19px; height: 19px; color: #ef8354; }
.report-note { font-size: 0.86rem; color: #888; margin-bottom: 14px; }

/* Comparison matrix */
.matrix-scroll { overflow-x: auto; border-radius: 12px; border: 1px solid rgba(0, 0, 0, 0.08); }
.comparison-matrix { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 0.9rem; background: #fff; }
.comparison-matrix th, .comparison-matrix td {
    text-align: left; padding: 12px 14px; border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    vertical-align: top;
}
.comparison-matrix thead th {
    background: #f6f7fa; font-weight: 700; color: #2b2d42;
    position: sticky; top: 0; white-space: nowrap;
}
.comparison-matrix tbody tr:hover { background: rgba(239, 131, 84, 0.04); }
.matrix-paper-col { min-width: 200px; max-width: 260px; }
.matrix-ref { font-weight: 800; color: #ef8354; margin-right: 4px; }
.matrix-title { display: block; font-weight: 600; color: #2b2d42; margin: 2px 0; }
.matrix-year { font-size: 0.8rem; color: #999; }
.cell-empty { color: #b0b0b8; font-style: italic; }

/* Methodology groups + diagram */
.groups-layout { display: flex; flex-direction: column; gap: 18px; align-items: stretch; }
.groups-list { display: flex; flex-direction: column; gap: 12px; }
.group-card {
    background: #fff; border: 1px solid rgba(0, 0, 0, 0.08);
    border-left: 3px solid #ef8354; border-radius: 10px; padding: 14px 16px;
}
.group-card h4 { font-size: 1rem; color: #2b2d42; margin-bottom: 5px; }
.group-card p { font-size: 0.9rem; color: #666; margin: 0; }
.group-ref { font-size: 0.8rem; font-weight: 700; color: #ef8354; }
.groups-diagram {
    background: #fff; border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px; padding: 22px; overflow: auto; text-align: center;
}
.groups-diagram .mermaid { margin: 0; display: inline-block; }
.groups-diagram svg { height: auto; max-width: none; }
.groups-diagram svg .nodeLabel, .groups-diagram svg text { font-size: 16px; }

/* Consensus / disagreement columns */
.report-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.report-col h3 {
    display: flex; align-items: center; gap: 8px;
    font-size: 1.05rem; color: #2b2d42; margin-bottom: 10px;
}
.report-col h3 i, .report-col h3 svg { width: 17px; height: 17px; color: #ef8354; }
.report-ul { padding-left: 20px; margin: 0; }
.report-ul li { color: #444; font-size: 0.95rem; margin-bottom: 8px; line-height: 1.5; }
.report-ul .list-empty { color: #aaa; font-style: italic; list-style: none; margin-left: -20px; }

/* Sources */
.sources-count { font-size: 0.9rem; font-weight: 500; color: #999; }
.sources-list { display: flex; flex-direction: column; gap: 8px; }
.source-row {
    display: flex; align-items: flex-start; gap: 12px;
    background: #fff; border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px; padding: 12px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.source-row:hover { border-color: rgba(239, 131, 84, 0.4); box-shadow: 0 4px 14px rgba(43, 45, 66, 0.06); }
.source-num { font-weight: 800; color: #ef8354; flex-shrink: 0; padding-top: 1px; }
.source-body { flex: 1; min-width: 0; }
.source-title { display: block; font-weight: 600; color: #2b2d42; cursor: pointer; }
.source-title:hover { color: #ef8354; text-decoration: underline; }
.source-meta { font-size: 0.82rem; color: #888; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.src-analyzed {
    font-size: 0.72rem; color: #7a7a86; background: #f0f1f5;
    padding: 1px 7px; border-radius: 6px;
}
.src-fulltext { color: #1f7a54; background: rgba(31, 122, 84, 0.12); }
.src-tag { font-size: 0.72rem; color: #ef8354; background: rgba(239, 131, 84, 0.1); padding: 1px 7px; border-radius: 6px; }
.source-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.src-link, .src-open {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.82rem; font-weight: 600; color: #555;
    background: #f6f7fa; border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px; padding: 7px 11px; cursor: pointer; white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.src-link i, .src-open i, .src-link svg, .src-open svg { width: 14px; height: 14px; }
.src-link:hover, .src-open:hover { border-color: #ef8354; color: #ef8354; }
.src-open:disabled { opacity: 0.6; cursor: default; }

.report-disclaimer {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.84rem; color: #999; margin-top: 26px;
    padding-top: 18px; border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.report-disclaimer i, .report-disclaimer svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 760px) {
    .synth-header h1 { font-size: 2rem; }
    .groups-layout, .report-cols { grid-template-columns: 1fr; }
    .report-head { flex-direction: column; }
}

/* Stack the search bar into one rounded column — matches browse.css .search-bar */
@media (max-width: 640px) {
    .synth-search-bar { flex-direction: column; align-items: stretch; }
    .synth-search-bar input {
        border-right: 2px solid rgba(0, 0, 0, 0.1);
        border-radius: 12px 12px 0 0;
    }
    .synth-search-bar .btn-search {
        width: 100%;
        border-radius: 0 0 12px 12px;
    }
}

/* ─── Print / Export as PDF ───────────────────────────────── */
@media print {
    .navbar, .footer, .synth-header, .synth-progress, .synth-gate,
    .synth-error, .report-actions, .source-actions, .report-disclaimer,
    .theme-toggle { display: none !important; }
    .synth-main { max-width: 100%; padding: 0; }
    .synth-report { display: block !important; }
    .report-block { break-inside: avoid; }
    .source-row, .group-card, .comparison-matrix tr { break-inside: avoid; }
    body { background: #fff; }
    .report-tldr { background: #f7f7f7 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ═══ DARK MODE ═══════════════════════════════════════════ */
html[data-theme="dark"] .synth-header h1,
html[data-theme="dark"] .report-question,
html[data-theme="dark"] .report-tldr p,
html[data-theme="dark"] .matrix-title,
html[data-theme="dark"] .group-card h4,
html[data-theme="dark"] .source-title,
html[data-theme="dark"] .synth-progress-title,
html[data-theme="dark"] .comparison-matrix thead th,
html[data-theme="dark"] .report-block > h3,
html[data-theme="dark"] .report-col h3 { color: #e8e8f2; }

html[data-theme="dark"] .synth-header > p,
html[data-theme="dark"] .report-ul li,
html[data-theme="dark"] .group-card p { color: #b8b8c8; }

html[data-theme="dark"] .synth-gate,
html[data-theme="dark"] .synth-progress,
html[data-theme="dark"] .synth-error,
html[data-theme="dark"] .report-action,
html[data-theme="dark"] .group-card,
html[data-theme="dark"] .source-row,
html[data-theme="dark"] .groups-diagram,
html[data-theme="dark"] .comparison-matrix {
    background: #1c1c26;
    border-color: rgba(255, 255, 255, 0.09);
}
html[data-theme="dark"] .synth-search-bar input {
    background: #1c1c26;
    border-color: rgba(255, 255, 255, 0.12);
    color: #e8e8f2;
}
html[data-theme="dark"] .synth-search-bar input::placeholder { color: #6f6f7c; }
html[data-theme="dark"] .comparison-matrix th,
html[data-theme="dark"] .comparison-matrix td { border-bottom-color: rgba(255, 255, 255, 0.07); }
html[data-theme="dark"] .comparison-matrix thead th { background: #24242f; }
html[data-theme="dark"] .comparison-matrix td { color: #cfcfda; }
html[data-theme="dark"] .comparison-matrix tbody tr:hover { background: rgba(239, 131, 84, 0.07); }
html[data-theme="dark"] .cell-empty { color: #6a6a78; }
html[data-theme="dark"] .mode-toggle { background: #24242f; }
html[data-theme="dark"] .mode-btn.active { background: #1c1c26; color: #f4a261; }
html[data-theme="dark"] .synth-example { background: #1c1c26; border-color: rgba(255, 255, 255, 0.1); color: #c0c0cc; }
html[data-theme="dark"] .synth-example:hover { border-color: #f4a261; color: #f4a261; }
html[data-theme="dark"] .src-link, html[data-theme="dark"] .src-open { background: #24242f; border-color: rgba(255, 255, 255, 0.1); color: #c0c0cc; }
html[data-theme="dark"] .src-analyzed { background: #24242f; color: #9a9aa8; }
html[data-theme="dark"] .src-fulltext { color: #6cd3a0; background: rgba(108, 211, 160, 0.12); }
html[data-theme="dark"] .report-note,
html[data-theme="dark"] .source-meta,
html[data-theme="dark"] .report-disclaimer,
html[data-theme="dark"] .sources-count { color: #8a8a98; }
html[data-theme="dark"] .report-head { border-bottom-color: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .matrix-scroll { border-color: rgba(255, 255, 255, 0.09); }
