/**
 * EvidenX v4 — Sidebar Layout CSS
 * Layout com corpus central e sidebars laterais expansíveis
 */

/* ═══════════════════════════════════════════════════════════════════════════
   RESULTS LAYOUT (3 colunas)
   ═══════════════════════════════════════════════════════════════════════════ */

.results-layout {
    display: flex;
    width: 100%;
    min-height: calc(100vh - 180px);
    position: relative;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBARS
   ═══════════════════════════════════════════════════════════════════════════ */

.sidebar {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: width 0.3s ease, min-width 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-left {
    border-radius: 0 12px 12px 0;
    border-left: none;
}

.sidebar-right {
    border-radius: 12px 0 0 12px;
    border-right: none;
}

/* Sidebar Collapsed */
.sidebar.collapsed {
    width: 48px;
    min-width: 48px;
}

.sidebar.collapsed .sidebar-content {
    display: none;
}

.sidebar.collapsed .sidebar-toggle {
    flex-direction: column;
    padding: 12px 8px;
    gap: 8px;
}

.sidebar.collapsed .sidebar-toggle-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 0.7rem;
}

.sidebar.collapsed .sidebar-arrow {
    transform: rotate(0);
}

/* Sidebar Expanded */
.sidebar.expanded {
    width: 320px;
    min-width: 320px;
}

.sidebar-left.expanded {
    border-right: 1px solid var(--border-color);
}

.sidebar-right.expanded {
    border-left: 1px solid var(--border-color);
}

.sidebar.expanded .sidebar-toggle {
    display: none;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--text-primary);
    transition: background 0.2s;
    width: 100%;
}

.sidebar-toggle:hover {
    background: var(--bg-tertiary);
}

.sidebar-toggle-icon {
    font-size: 1.2rem;
}

.sidebar-toggle-text {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.sidebar-arrow {
    font-size: 1rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 5;
}

.sidebar-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.sidebar-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Sidebar Sections */
.sidebar-section {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

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

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
}

.sidebar-section-content {
    font-size: 0.85rem;
}

.sidebar-actions {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    margin-top: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR LEFT - Analysis Components
   ═══════════════════════════════════════════════════════════════════════════ */

/* Scope Grid */
.scope-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.scope-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.scope-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.scope-value {
    font-size: 0.85rem;
    font-weight: 600;
}

.scope-value.success { color: var(--success); }
.scope-value.warning { color: var(--warning); }
.scope-value.danger { color: var(--danger); }

/* Metrics Compact */
.metrics-compact {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.metric-compact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border-radius: 8px;
}

.metric-compact .metric-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 32px;
}

.metric-compact .metric-value {
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 40px;
}

.metric-compact .metric-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    flex: 1;
}

/* Pyramid Compact */
.pyramid-compact {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pyramid-layer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pyramid-layer .layer-label {
    font-size: 0.7rem;
    font-weight: 700;
    width: 16px;
    text-align: center;
}

.pyramid-layer[data-layer="A"] .layer-label { color: #10b981; }
.pyramid-layer[data-layer="B"] .layer-label { color: #3b82f6; }
.pyramid-layer[data-layer="C"] .layer-label { color: #f59e0b; }
.pyramid-layer[data-layer="D"] .layer-label { color: #8b5cf6; }
.pyramid-layer[data-layer="E"] .layer-label { color: #6b7280; }

.layer-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.layer-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.pyramid-layer[data-layer="A"] .layer-fill { background: #10b981; }
.pyramid-layer[data-layer="B"] .layer-fill { background: #3b82f6; }
.pyramid-layer[data-layer="C"] .layer-fill { background: #f59e0b; }
.pyramid-layer[data-layer="D"] .layer-fill { background: #8b5cf6; }
.pyramid-layer[data-layer="E"] .layer-fill { background: #6b7280; }

.layer-value {
    font-size: 0.7rem;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
}

/* Viability Compact */
.viability-compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.viability-compact .viability-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-primary);
    border-radius: 6px;
    font-size: 0.8rem;
}

.viability-compact .viability-icon {
    font-size: 0.9rem;
}

.viability-compact .viability-item.success { border-left: 3px solid var(--success); }
.viability-compact .viability-item.warning { border-left: 3px solid var(--warning); }
.viability-compact .viability-item.danger { border-left: 3px solid var(--danger); }

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR RIGHT - Acquisition Components
   ═══════════════════════════════════════════════════════════════════════════ */

/* Selection Summary */
.selection-summary {
    text-align: center;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
}

.selection-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
}

.selection-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Coverage Bars */
.coverage-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.coverage-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.coverage-row .coverage-label {
    font-size: 0.7rem;
    min-width: 80px;
    color: var(--text-secondary);
}

.coverage-row .coverage-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.coverage-row .coverage-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.coverage-fill.oa { background: var(--success); }
.coverage-fill.accessible { background: var(--warning); }
.coverage-fill.paywall { background: var(--danger); }

.coverage-pct {
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 32px;
    text-align: right;
}

.coverage-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
}

/* Legal Sources */
.legal-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.legal-source {
    font-size: 0.65rem;
    padding: 3px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    color: var(--text-secondary);
}

.legal-note {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Study Type List */
.study-type-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.study-type-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
}

.study-type-name {
    flex: 1;
    color: var(--text-secondary);
}

.study-type-count {
    font-weight: 600;
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CORPUS CONTAINER (Centro)
   ═══════════════════════════════════════════════════════════════════════════ */

.corpus-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0 16px;
}

/* Corpus Header */
.corpus-header {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 5;
}

.corpus-title-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.corpus-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.corpus-query {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 4px 12px;
    border-radius: 20px;
}

/* Corpus Stats */
.corpus-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.corpus-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.corpus-stat .stat-value {
    font-size: 1rem;
    font-weight: 700;
}

.corpus-stat .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.corpus-stat.oa .stat-value { color: var(--success); }
.corpus-stat.accessible .stat-value { color: var(--warning); }
.corpus-stat.paywall .stat-value { color: var(--danger); }

/* Validation Progress */
.validation-progress {
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.validation-progress .progress-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.validation-progress .progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
}

.validation-progress .progress-text {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Corpus Filters */
.corpus-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.filter-group select {
    font-size: 0.8rem;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.filter-chips {
    display: flex;
    gap: 6px;
}

.filter-chip {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-chip input {
    display: none;
}

.filter-chip.active {
    background: var(--accent);
    color: white;
}

.filter-chip:hover {
    opacity: 0.8;
}

.filter-actions {
    margin-left: auto;
}

/* Article List */
.article-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.article-list-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* Article Card */
.article-card {
    display: flex;
    gap: 12px;
    padding: 16px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    cursor: pointer;
}

.article-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px var(--shadow);
}

.article-card.selected {
    border-color: var(--accent);
    background: var(--accent-light);
}

.article-checkbox {
    flex-shrink: 0;
}

.article-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.article-content {
    flex: 1;
    min-width: 0;
}

.article-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 6px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.article-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.article-tag {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.article-tag.layer-a { background: #d1fae5; color: #065f46; }
.article-tag.layer-b { background: #dbeafe; color: #1e40af; }
.article-tag.layer-c { background: #fef3c7; color: #92400e; }
.article-tag.layer-d { background: #ede9fe; color: #5b21b6; }
.article-tag.layer-e { background: #f3f4f6; color: #374151; }

.article-tag.oa { background: #d1fae5; color: #065f46; }
.article-tag.accessible { background: #fef3c7; color: #92400e; }
.article-tag.paywall { background: #fee2e2; color: #991b1b; }

.article-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.article-actions .btn-xs {
    font-size: 0.7rem;
    padding: 4px 8px;
}

/* Load More */
.load-more-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
}

.load-more-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .sidebar.expanded {
        width: 280px;
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .results-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100% !important;
        min-width: 100% !important;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .sidebar.collapsed {
        height: 48px;
    }
    
    .sidebar.collapsed .sidebar-toggle {
        flex-direction: row;
        padding: 12px 16px;
    }
    
    .sidebar.collapsed .sidebar-toggle-text {
        writing-mode: horizontal-tb;
    }
    
    .sidebar.expanded {
        max-height: 50vh;
    }
    
    .sidebar-left {
        order: 2;
    }
    
    .corpus-container {
        order: 1;
    }
    
    .sidebar-right {
        order: 3;
    }
    
    .corpus-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-actions {
        margin-left: 0;
        margin-top: 8px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   DARK THEME ADJUSTMENTS
   ═══════════════════════════════════════════════════════════════════════════ */

[data-theme="dark"] .sidebar {
    background: var(--bg-secondary);
}

[data-theme="dark"] .article-card {
    background: var(--bg-secondary);
}

[data-theme="dark"] .article-card.selected {
    background: rgba(139, 92, 246, 0.1);
}

[data-theme="dark"] .article-tag.layer-a { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
[data-theme="dark"] .article-tag.layer-b { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
[data-theme="dark"] .article-tag.layer-c { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
[data-theme="dark"] .article-tag.layer-d { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
[data-theme="dark"] .article-tag.layer-e { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }

[data-theme="dark"] .filter-chip.active {
    background: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOOLTIPS SYSTEM
   ═══════════════════════════════════════════════════════════════════════════ */

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before,
[data-tooltip]::after {
    position: absolute;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    pointer-events: none;
}

/* Tooltip content */
[data-tooltip]::after {
    content: attr(data-tooltip);
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    max-width: 280px;
    white-space: normal;
    text-align: left;
}

/* Tooltip arrow */
[data-tooltip]::before {
    content: '';
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border-color);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Position variants */
[data-tooltip-pos="right"]::after {
    bottom: auto;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
}

[data-tooltip-pos="right"]::before {
    bottom: auto;
    left: calc(100% + 2px);
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: var(--border-color);
}

[data-tooltip-pos="bottom"]::after {
    bottom: auto;
    top: calc(100% + 8px);
}

[data-tooltip-pos="bottom"]::before {
    bottom: auto;
    top: calc(100% + 2px);
    border: 6px solid transparent;
    border-bottom-color: var(--border-color);
}

/* Tooltip for metrics - special styling */
.metric-compact[data-tooltip]::after {
    min-width: 200px;
}

/* Tooltip colors by type */
[data-tooltip-type="info"]::after { border-left: 3px solid #3b82f6; }
[data-tooltip-type="success"]::after { border-left: 3px solid #10b981; }
[data-tooltip-type="warning"]::after { border-left: 3px solid #f59e0b; }
[data-tooltip-type="danger"]::after { border-left: 3px solid #ef4444; }

/* ═══════════════════════════════════════════════════════════════════════════
   HYBRID ACCESS COLORS (Decision: 2 visual colors + tooltip details)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Green = Any legal access */
.access-status.legal,
.access-status.gold-oa,
.access-status.green-oa,
.access-status.bronze-oa,
.access-status.preprint,
.access-status.author-copy {
    color: #10b981;
}

.access-status.legal::before,
.access-status.gold-oa::before,
.access-status.green-oa::before,
.access-status.bronze-oa::before,
.access-status.preprint::before,
.access-status.author-copy::before {
    content: '🟢';
    margin-right: 4px;
}

/* Red = Paywall */
.access-status.paywall,
.access-status.not-found {
    color: #ef4444;
}

.access-status.paywall::before,
.access-status.not-found::before {
    content: '🔴';
    margin-right: 4px;
}

/* Access badge in article cards */
.article-access {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.article-access.legal {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.article-access.paywall {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

[data-theme="dark"] .article-access.legal {
    background: rgba(16, 185, 129, 0.2);
}

[data-theme="dark"] .article-access.paywall {
    background: rgba(239, 68, 68, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MESH TAGS COMPACT (Sidebar)
   ═══════════════════════════════════════════════════════════════════════════ */

.mesh-tags-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.mesh-tag-compact {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    cursor: help;
}

.mesh-tag-compact.mapped,
.mesh-tag-compact.recognized {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.mesh-tag-compact.free,
.mesh-tag-compact.unrecognized {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.mesh-coverage-compact,
.expansion-note,
.interpretation-note {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 0;
}

.expansion-note,
.interpretation-note {
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   QUERY INTERPRETATION (new semantic UI)
   ═══════════════════════════════════════════════════════════════════════════ */

.query-terms {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.term-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: help;
}

.term-row.as-written {
    background: rgba(16, 185, 129, 0.08);
}

.term-row.expanded {
    background: rgba(139, 92, 246, 0.08);
}

.term-icon {
    font-size: 0.9rem;
    width: 16px;
    text-align: center;
}

.term-row.as-written .term-icon {
    color: #10b981;
}

.term-row.expanded .term-icon {
    color: #8b5cf6;
}

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

.term-expansion {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Search Profile values */
.scope-value.info {
    color: #3b82f6;
}

[data-theme="dark"] .scope-value.info {
    color: #60a5fa;
}

/* Search hint */
.search-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 8px 0 0 0;
    text-align: center;
    opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════════════════════
   VALUE PROPOSITION SECTION (Phase 1)
   ═══════════════════════════════════════════════════════════════════════════ */

.value-section {
    text-align: center;
}

.value-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.value-grid {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.value-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    max-width: 150px;
}

.value-icon {
    font-size: 1.75rem;
    margin-bottom: 4px;
}

.value-icon-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    transition: transform 0.2s ease;
}

.value-item:hover .value-icon-img {
    transform: scale(1.1);
}

.value-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.value-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.4;
}

/* Tagline Section */
.tagline-section {
    text-align: center;
    padding: 16px 0;
}

.tagline {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0 0 16px 0;
    padding: 0 20px;
    border: none;
    background: none;
    line-height: 1.5;
}

.tagline-section .btn {
    font-size: 0.85rem;
}

/* Sources Footer */
.sources-footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 16px;
}

.sources-label {
    font-weight: 500;
    margin-right: 4px;
}

/* Trust Anchor (scientific credibility) */
.trust-anchor {
    text-align: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.trust-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .value-grid {
        gap: 24px;
    }
    
    .value-item {
        max-width: 120px;
    }
    
    .tagline {
        font-size: 0.85rem;
        padding: 0 10px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   VALIDATION PROGRESS ENHANCED
   ═══════════════════════════════════════════════════════════════════════════ */

.corpus-stat.validating {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.corpus-stat.legal .stat-value {
    color: #10b981;
}

.corpus-stat.paywall .stat-value {
    color: #ef4444;
}

/* Coverage bars colors */
.coverage-fill.legal {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.coverage-fill.oa {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.coverage-fill.paywall {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

/* ═══════════════════════════════════════════════════════════════════════════
   AVAILABILITY HIGHLIGHT (o que existe)
   ═══════════════════════════════════════════════════════════════════════════ */

.availability-highlight {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 12px;
    background: rgba(16, 185, 129, 0.08);
    border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.availability-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: #10b981;
    line-height: 1;
}

.availability-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.availability-pct {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SELECTION (ação do usuário)
   ═══════════════════════════════════════════════════════════════════════════ */

.selection-summary {
    text-align: center;
    padding: 12px;
}

.selection-count {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.selection-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.selection-hint-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* Quando tem seleção */
.selection-active .selection-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.selection-active .selection-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CORPUS CONTEXT LABEL (sort explanation)
   ═══════════════════════════════════════════════════════════════════════════ */

.corpus-context {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: rgba(16, 185, 129, 0.06);
    border-radius: 6px;
    border-left: 3px solid #10b981;
}

.context-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

[data-theme="dark"] .corpus-context {
    background: rgba(16, 185, 129, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PDF PENDING BUTTON (OA without indexed PDF)
   ═══════════════════════════════════════════════════════════════════════════ */

.btn.pdf-pending {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
    cursor: help;
}

.btn.pdf-pending:hover {
    background: rgba(245, 158, 11, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════
   OA PENDING STATE (metadata only, not verified)
   ═══════════════════════════════════════════════════════════════════════════ */

.article-access.oa-pending {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #f59e0b !important;
    border-color: rgba(245, 158, 11, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════════
   METRICS EXPLANATION (contextual insight for low scores)
   ═══════════════════════════════════════════════════════════════════════════ */

.metrics-explanation {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(139, 92, 246, 0.08);
    border-radius: 6px;
    border-left: 3px solid #8b5cf6;
}

.explanation-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

[data-theme="dark"] .metrics-explanation {
    background: rgba(139, 92, 246, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACCESS FILTER CHIPS
   ═══════════════════════════════════════════════════════════════════════════ */

.access-filter {
    gap: 4px;
}

.access-filter .filter-chip {
    padding: 4px 8px;
    font-size: 0.7rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOP RESULT BADGE (ARS high score indicator)
   ═══════════════════════════════════════════════════════════════════════════ */

.article-card.top-result {
    border-left: 3px solid #f59e0b;
    background: rgba(245, 158, 11, 0.03);
}

.top-result-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: help;
}

[data-theme="dark"] .article-card.top-result {
    background: rgba(245, 158, 11, 0.08);
}
