/* English comments are mandatory. */
/* Report styles — migrated from style.css, adapted for CSS variables. */
/* These styles apply to the SSR-rendered report HTML loaded via innerHTML. */

/* ================================================================
   REPORT CONTAINER
   ================================================================ */
.report-container {
    max-width: 1100px;
    margin: 0 auto;
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* ================================================================
   REPORT HEADER
   ================================================================ */
.report-header {
    background: var(--bg-card);
    border-top: 5px solid var(--accent);
    border-bottom: 1px solid var(--border);
    padding: 2em;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

.report-header h1 {
    margin: 0 0 10px 0;
    font-size: 1.8em;
    border-bottom: none;
    color: var(--text-primary);
}

.report-header p {
    margin: 5px 0 0;
    color: var(--text-secondary);
}

.report-header a {
    color: var(--accent);
    text-decoration: none;
}

.report-header a:hover {
    text-decoration: underline;
}

/* ================================================================
   REPORT SECTIONS
   ================================================================ */
.report-section {
    padding: 1.5em 2em;
    border-bottom: 1px solid var(--border-subtle);
}

.report-section:last-child {
    border-bottom: none;
}

.report-section h2 {
    margin-top: 0;
    color: var(--text-primary);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.3em;
    margin-bottom: 1em;
    font-size: 1.5em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-section h3 {
    color: var(--text-secondary);
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    font-size: 1.2em;
}

/* ================================================================
   SCORE CARDS
   ================================================================ */
.scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 1.5em;
}

.score-card {
    background-color: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 150px;
    cursor: help;
    transition: box-shadow var(--transition), transform 0.15s;
}

.score-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.score-card .score-value {
    font-family: var(--font-display);
    font-size: 3.2em;
    font-weight: 600;
    line-height: 1.1;
}

.score-card .score-title {
    font-size: 1.1em;
    font-weight: 500;
    color: var(--text-primary);
    margin-top: 8px;
    margin-bottom: 5px;
}

.score-card .score-description {
    font-size: 0.85em;
    color: var(--text-muted);
    line-height: 1.3;
}

.score-high   { color: var(--success); }
.score-medium { color: var(--warning); }
.score-low    { color: var(--danger); }
.score-na     { color: var(--text-muted); }

/* ================================================================
   STATS GRID
   ================================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 1.5em;
}

.stats-block {
    background-color: var(--bg-hover);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 15px;
}

.stats-block h3 {
    margin-top: 0;
    font-size: 1.2em;
    color: var(--text-secondary);
}

.stats-block ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.stats-block li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.stats-block li:last-child {
    border-bottom: none;
}

.stats-block li .label {
    color: var(--text-muted);
}

.stats-block li .value {
    font-weight: 600;
    color: var(--text-primary);
}

/* ================================================================
   TERM GRID
   ================================================================ */
.term-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 1em;
}

.term-item {
    background-color: var(--bg-hover);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.9em;
    line-height: 1.4;
    transition: background-color 0.15s;
}

.term-item:hover {
    background-color: var(--border);
}

.term-item .term {
    font-weight: 500;
    color: var(--text-primary);
}

.term-item .score {
    color: var(--text-muted);
    margin-left: 5px;
    font-size: 0.85em;
}

/* ================================================================
   DETAILS SECTION
   ================================================================ */
.details-section ul {
    list-style-type: disc;
    padding-left: 25px;
    margin-top: 0.5em;
}

.details-section li {
    margin-bottom: 0.6em;
}

.details-section code {
    background-color: var(--accent-subtle);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.95em;
    border: 1px solid var(--border-subtle);
}

/* ================================================================
   MARKDOWN TASK (TЗ section)
   ================================================================ */
.markdown-task pre {
    background-color: var(--bg-hover);
    padding: 1em;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: var(--font-mono);
    max-height: 600px;
    overflow-y: auto;
    font-size: 0.9em;
    color: var(--text-primary);
}

/* ================================================================
   CHECKLIST
   ================================================================ */
.checklist ul {
    list-style-type: disc;
    padding-left: 20px;
}

.checklist li {
    margin-bottom: 0.6em;
}

/* ================================================================
   ALERT BANNERS (analysis_warnings — aggregators, cluster mismatch)
   ================================================================ */
.alert-banner {
    background: linear-gradient(135deg, var(--warning-bg), rgba(245, 158, 11, 0.12));
    border-left: 4px solid var(--warning);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-top: 10px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    box-shadow: 0 1px 6px rgba(245, 158, 11, 0.1);
}

.alert-banner .banner-icon {
    font-size: 1.3em;
    line-height: 1;
    flex-shrink: 0;
}

.alert-banner .banner-content p {
    margin: 0;
    font-size: 0.93em;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* ================================================================
   PRUNED-NOTICE (Phase 26.4: retention notice, unobtrusive)
   ================================================================ */
.pruned-notice {
    background: var(--surface-2, rgba(148, 163, 184, 0.1));
    border-left: 4px solid var(--text-secondary, #94a3b8);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-top: 10px;
    font-size: 0.88em;
    line-height: 1.5;
    color: var(--text-secondary, #64748b);
}

/* ================================================================
   SHARED-REPORT FOOTER (Phase 26.7: branding on public share view)
   ================================================================ */
.shared-footer {
    margin-top: var(--space-8, 2rem);
    padding: var(--space-4, 1rem);
    text-align: center;
    font-size: 0.9em;
    color: var(--text-secondary, #64748b);
    border-top: 1px solid var(--border-subtle, #f1f5f9);
}

.shared-footer a {
    color: var(--accent, #059669);
    font-weight: 600;
    text-decoration: none;
}

.shared-footer a:hover {
    text-decoration: underline;
}

/* ================================================================
   INTENT MISMATCH BANNER
   ================================================================ */
.intent-mismatch-banner {
    background: linear-gradient(135deg, var(--warning-bg), rgba(245, 158, 11, 0.15));
    border-left: 4px solid var(--warning);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-top: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.intent-mismatch-banner .banner-icon {
    font-size: 1.5em;
    line-height: 1;
    flex-shrink: 0;
}

.intent-mismatch-banner .banner-content {
    color: var(--text-primary);
}

.intent-mismatch-banner .banner-content strong {
    display: block;
    font-size: 1.05em;
    margin-bottom: 4px;
    color: var(--warning);
}

.intent-mismatch-banner .banner-content p {
    margin: 0;
    font-size: 0.95em;
    line-height: 1.5;
    opacity: 1;
    color: var(--text-secondary);
}

/* ================================================================
   REPORT BUTTONS (copy, PDF export, back)
   ================================================================ */
.copy-button {
    background-color: var(--text-muted);
    color: white;
    padding: 5px 10px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8em;
    margin-left: 10px;
    transition: background-color var(--transition);
    font-family: var(--font-sans);
}

.copy-button:hover {
    background-color: var(--text-secondary);
}

.pdf-export-button {
    display: inline-block;
    background-color: var(--success);
    color: white;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 500;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: background-color var(--transition), box-shadow var(--transition);
}

.pdf-export-button:hover {
    background-color: #16a34a;
    box-shadow: var(--shadow-sm);
}

.reanalyze-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: transparent;
    color: var(--text-primary);
    padding: 9px 17px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid var(--border);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: background-color var(--transition), border-color var(--transition);
}

.reanalyze-button:hover:not(:disabled) {
    background-color: var(--bg-hover);
    border-color: var(--text-muted);
}

.reanalyze-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.back-button {
    background-color: var(--text-muted);
    color: white;
    padding: 8px 14px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9em;
    margin-bottom: 1em;
    font-family: var(--font-sans);
    transition: background-color var(--transition);
}

.back-button:hover {
    background-color: var(--text-secondary);
}

/* ================================================================
   ERROR MESSAGE
   ================================================================ */
.error-message {
    color: var(--danger-text);
    background-color: var(--danger-bg);
    border: 1px solid var(--danger);
    padding: 1em;
    border-radius: var(--radius-md);
    margin-top: 1em;
}

.error-message p {
    font-weight: bold;
    color: var(--danger);
}

.error-message pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.9em;
}

/* ================================================================
   PRINT
   ================================================================ */
@media print {
    .pdf-export-button,
    .reanalyze-button,
    .copy-button,
    .back-button {
        display: none !important;
    }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .scores-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
    }

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

    .report-section {
        padding: 1em 1.2em;
    }

    .report-header {
        padding: 1em 1.2em;
    }
}
