:root {
    --card-elev: 0 2px 8px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: var(--background);
    color: var(--foreground);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

h1, h2, h3, .brand, .card-title, .results-heading {
    font-family: 'Merriweather', serif;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px;
}

.site-nav {
    background: var(--sidebar-background);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 14px 0;
}

.brand {
    color: var(--foreground);
    font-weight: 700;
    font-size: 1.25rem;
    text-decoration: none;
    letter-spacing: 0.4px;
    justify-self: start;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo {
    height: 32px;
    width: auto;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: center;
    width: 100%;
    max-width: 500px;
}

.search-input {
    background: var(--input);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 6px;
    color: var(--foreground);
    width: 100%;
    transition: box-shadow .25s ease, border-color .18s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px var(--ring);
}

.search-btn {
    background: var(--primary);
    border: none;
    color: var(--primary-foreground);
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .16s ease;
    white-space: nowrap;
}

.search-btn:hover {
    opacity: 0.9;
}

.site-main {
    padding: 28px 0;
}

.controls {
    margin-bottom: 20px;
}

.controls-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.control-toggle {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 6px;
    color: var(--foreground);
    cursor: pointer;
    font-weight: 500;
}

.control-toggle:hover {
    background: var(--secondary);
}

.panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height .36s cubic-bezier(.2, .9, .2, 1);
    background: var(--card);
    border: 1px solid var(--border);
    margin-top: 12px;
    padding: 0;
    border-radius: 8px;
}

.panel.show-collapse {
    max-height: 800px;
    padding: 16px;
}

.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    background: var(--secondary);
    cursor: pointer;
}

.source-item:hover {
    background: var(--muted);
}

.source-item input {
    accent-color: var(--primary);
}

.source-name {
    color: var(--foreground);
    font-size: 0.95rem;
}

.quick-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    background: var(--secondary);
    border: 1px solid var(--border);
    color: var(--secondary-foreground);
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .12s ease;
    font-size: 0.9rem;
}

.chip:hover {
    background: var(--muted);
}

.filter-actions .btn {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.btn {
    background: var(--secondary);
    border: 1px solid var(--border);
    color: var(--secondary-foreground);
    cursor: pointer;
    font-weight: 500;
}

.btn:hover {
    background: var(--muted);
}

.btn.ghost {
    background: transparent;
    border-color: transparent;
}

.btn.ghost:hover {
    background: var(--secondary);
    color: var(--foreground); /* Ensure visibility */
}

.btn.accent {
    background: var(--primary);
    border: none;
    color: var(--primary-foreground);
}

.btn.accent:hover {
    opacity: 0.9;
}

.articles .grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 40px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    transform: translateY(0);
    transition: transform .2s ease, box-shadow .2s ease;
    color: var(--card-foreground);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.card-title {
    margin: 0 0 10px 0;
    font-size: 1.15rem;
    line-height: 1.4;
}

.card-title a {
    color: var(--foreground);
    text-decoration: none;
}

.card-title a:hover {
    color: var(--primary);
}

.meta {
    color: var(--muted-foreground);
    font-size: 0.85rem;
    margin-bottom: 14px;
}

.source {
    font-weight: 600;
    color: var(--primary);
}

.read-more {
    display: inline-block;
    padding: 8px 14px;
    background: var(--secondary);
    border-radius: 6px;
    color: var(--secondary-foreground);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background .15s;
}

.read-more:hover {
    background: var(--muted);
}

.pagination.center {
    display: flex;
    justify-content: center;
    margin-top: 32px;
    gap: 10px;
}

.page-btn {
    padding: 10px 16px;
    border-radius: 6px;
    background: var(--card);
    color: var(--foreground);
    border: 1px solid var(--border);
    text-decoration: none;
    font-weight: 500;
    transition: border-color .15s;
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.results-heading {
    font-weight: 600;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.query {
    color: var(--primary);
}

@media (max-width: 760px) {
    .nav-inner {
        grid-template-columns: 1fr;
        gap: 16px;
        justify-items: center;
    }

    .brand {
        justify-self: center;
    }
    
    .search-form {
        width: 100%;
    }

    .controls-top {
        flex-direction: column;
        align-items: stretch;
    }
    
    .quick-filters {
        flex-direction: column;
        align-items: stretch;
    }
}

.site-footer {
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 40px 0;
    margin-top: 60px;
    text-align: center;
    color: var(--muted-foreground);
    font-size: 0.9rem;
}

.dashboard-summary {
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--card);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--card-elev);
}

.dash-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dash-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--foreground);
}

.dash-value {
    font-size: 0.85rem;
    color: var(--muted-foreground);
}

.bias-slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bias-range {
    -webkit-appearance: none;
    width: 80px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
}

.bias-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.bias-mark {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted-foreground);
}

.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--input);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(16px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.card-metrics {
    margin: 16px 0;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.metric-bias, .metric-reliability {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.metric-label {
    font-weight: 600;
    color: var(--muted-foreground);
    min-width: 70px;
}

.bias-tag {
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bias-tag.left {
    background-color: #e8f0fe;
    color: #1a73e8;
}

.bias-tag.center {
    background-color: #f1f3f4;
    color: #5f6368;
}

.bias-tag.right {
    background-color: #fce8e6;
    color: #c5221f;
}

.progress-bar {
    flex-grow: 1;
    height: 6px;
    background-color: var(--secondary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #34a853;
    border-radius: 3px;
}

.reliability-score {
    font-weight: 600;
    color: #34a853;
}

@media (max-width: 760px) {
    .dashboard-summary {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 16px;
    }
    .dash-item {
        width: 100%;
        justify-content: space-between;
    }
}
