/* =========================================
   Profoundd Search Engine - Main Stylesheet
   ========================================= */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Light theme (default) */
    --bg: #f8f9fb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f1f3f6;
    --text: #1a1a2e;
    --text-secondary: #5a5d6e;
    --text-muted: #8b8fa3;
    --border: #e2e5eb;
    --accent: #4f46e5;
    --accent-hover: #6366f1;
    --accent-glow: rgba(79, 70, 229, 0.08);
    --success: #16a34a;
    --warning: #ca8a04;
    --danger: #dc2626;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);

    /* Category colors */
    --news: #2563eb;
    --medical: #dc2626;
    --legal: #9333ea;
    --tech: #0891b2;
    --finance: #16a34a;
    --science: #d97706;

    /* Theme-specific hardcoded overrides */
    --navbar-bg: rgba(255, 255, 255, 0.85);
    --hero-gradient: linear-gradient(180deg, #eef1f8 0%, var(--bg) 100%);
    --footer-bg: #f0f2f5;
    --overlay-bg: rgba(0,0,0,0.2);
    --credibility-help-bg: rgba(0,0,0,0.06);
    --search-controls-shadow: 0 1px 2px rgba(0,0,0,0.04);
    --disclaimer-shadow: 0 8px 32px rgba(0,0,0,0.15);
    --mark-bg: rgba(79, 70, 229, 0.12);
}

/* Dark theme */
[data-theme="dark"] {
    --bg: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a25;
    --bg-input: #1e1e2a;
    --text: #e8e8ed;
    --text-secondary: #9898a8;
    --text-muted: #6b6b7b;
    --border: #2a2a38;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.4);

    /* Category colors (brighter for dark bg) */
    --news: #3b82f6;
    --medical: #ef4444;
    --legal: #a855f7;
    --tech: #06b6d4;
    --finance: #22c55e;
    --science: #f59e0b;

    /* Theme-specific hardcoded overrides */
    --navbar-bg: rgba(18, 18, 26, 0.85);
    --hero-gradient: radial-gradient(ellipse at center top, var(--accent-glow), transparent 70%);
    --footer-bg: var(--bg-secondary);
    --overlay-bg: rgba(0,0,0,0.5);
    --credibility-help-bg: rgba(255,255,255,0.1);
    --search-controls-shadow: none;
    --disclaimer-shadow: 0 8px 32px rgba(0,0,0,0.5);
    --mark-bg: var(--accent-glow);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { color: var(--accent-hover); }

main { flex: 1; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Navbar --- */
.navbar {
    background: var(--navbar-bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.nav-content {
    display: flex;
    align-items: center;
    gap: 20px;
}
.logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}
.nav-links {
    display: flex;
    gap: 16px;
    margin-left: auto;
}
.nav-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}
.nav-links a:hover { color: var(--text); }

.nav-search-form {
    flex: 1;
    max-width: 500px;
}
.nav-search-input {
    width: 100%;
    padding: 9px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}
.nav-search-input:focus {
    border-color: var(--accent);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* --- Hero Section --- */
.hero {
    text-align: center;
    padding: 100px 0 70px;
    background: var(--hero-gradient);
}
.hero-title {
    font-size: 3.2rem;
    font-weight: 700;
    margin-bottom: 14px;
    letter-spacing: -1.5px;
    color: var(--text);
}
.hero-subtitle {
    color: var(--text-muted);
    font-size: 1.15rem;
    margin-bottom: 44px;
    font-weight: 400;
}

/* --- Search Form --- */
.hero-search {
    max-width: 680px;
    margin: 0 auto;
}
.search-input-group {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    overflow: hidden;
    transition: all 0.25s ease;
    box-shadow: var(--shadow);
}
.search-input-group:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg), 0 0 0 3px var(--accent-glow);
}
.search-input {
    flex: 1;
    padding: 16px 24px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.05rem;
    outline: none;
}
.search-input::placeholder { color: var(--text-muted); }
.category-select {
    padding: 16px 14px;
    background: transparent;
    border: none;
    border-left: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}
.search-btn {
    padding: 16px 32px;
    background: var(--accent);
    border: none;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 0 50px 50px 0;
}
.search-btn:hover { background: var(--accent-hover); }

/* --- Featured Links (below search bar) --- */
.featured-polymarket-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 50px;
    color: #818cf8;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    transition: all 0.2s ease;
}
.featured-polymarket-link:hover {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}
.featured-polymarket-link svg {
    stroke: #818cf8;
}
.featured-polls-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 50px;
    color: #a78bfa;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    transition: all 0.2s ease;
}
.featured-polls-link:hover {
    background: rgba(139, 92, 246, 0.18);
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}
.featured-polls-link svg {
    stroke: #a78bfa;
}
.featured-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}
.featured-badge-polls {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
}
.hero-featured {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

/* --- Category Cards --- */
.categories-section, .trending-section {
    padding: 60px 0;
}
.section-title {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 30px;
    text-align: center;
}
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}
.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    transition: all 0.25s;
    color: var(--text);
}
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}
.category-card h3 {
    font-size: 1rem;
    margin: 12px 0 6px;
}
.category-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.category-icon {
    color: var(--accent);
}

/* Category-specific colors */
.category-news .category-icon, .category-tag-news { color: var(--news); }
.category-medical .category-icon, .category-tag-medical { color: var(--medical); }
.category-legal .category-icon, .category-tag-legal { color: var(--legal); }
.category-tech .category-icon, .category-tag-tech { color: var(--tech); }
.category-finance .category-icon, .category-tag-finance { color: var(--finance); }
.category-science .category-icon, .category-tag-science { color: var(--science); }

.category-news:hover { border-color: var(--news); }
.category-medical:hover { border-color: var(--medical); }
.category-legal:hover { border-color: var(--legal); }
.category-tech:hover { border-color: var(--tech); }
.category-finance:hover { border-color: var(--finance); }
.category-science:hover { border-color: var(--science); }

/* --- Trending --- */
.trending-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.trending-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.2s;
}
.trending-card:hover { border-color: transparent; box-shadow: var(--shadow-lg); }
.trending-card h3 { font-size: 0.95rem; margin: 10px 0 8px; line-height: 1.4; }
.trending-card h3 a { color: var(--text); }
.trending-card h3 a:hover { color: var(--accent); }
.trending-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.trending-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
}

/* --- Article Detail Page --- */
.article-page { padding: 30px 0; max-width: 800px; }
.article-breadcrumb {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}
.article-breadcrumb a { color: var(--accent); text-decoration: none; }
.article-breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { margin: 0 6px; }
.article-detail {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}
.article-meta-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.article-detail h1 {
    font-size: 1.8rem;
    line-height: 1.3;
    margin: 0 0 12px 0;
    color: var(--text-primary);
}
.article-info {
    display: flex;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}
.article-summary {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-secondary);
    border-left: 3px solid var(--accent);
    padding-left: 16px;
    margin-bottom: 24px;
}
.article-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
}
.article-content p {
    margin: 0 0 1em 0;
}
.article-content p:last-child {
    margin-bottom: 0;
}
.article-source-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
}
.article-source-link:hover { text-decoration: underline; }
.article-hero-image {
    margin-bottom: 24px;
    border-radius: var(--radius);
    overflow: hidden;
}
.article-hero-image img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    display: block;
}
.article-footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
@media (max-width: 768px) {
    .article-detail { padding: 20px 16px; }
    .article-detail h1 { font-size: 1.4rem; }
    .article-hero-image img { max-height: 240px; }
}

/* --- Search Results Page --- */
.search-page { padding: 30px 0; }

/* Mobile back/home bar - hidden on desktop */
.mobile-back-bar {
    display: none;
    gap: 8px;
    margin-bottom: 12px;
}

.search-controls {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--search-controls-shadow);
}
.search-filters {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.filter-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.filter-group select,
.filter-group input[type="date"] {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
}
.filter-group input[type="date"] {
    min-width: 130px;
}
.filter-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: var(--date-picker-filter, none);
}
[data-theme="dark"] {
    --date-picker-filter: invert(0.8);
}
.filter-presets {
    display: flex;
    gap: 4px;
}
.filter-presets button {
    padding: 4px 10px;
    font-size: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.filter-presets button:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.active-filters-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    font-size: 0.78rem;
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    border-radius: 20px;
    color: var(--accent);
}
.filter-chip a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1;
}
.filter-chip a:hover {
    color: var(--danger);
}
.clear-all-filters {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: underline;
    margin-left: 4px;
}
/* Epstein search highlights + AI explain */
.highlight-snippet mark,
.result-title mark,
.doc-viewer-content mark {
    background: rgba(234, 179, 8, 0.35);
    color: inherit;
    padding: 1px 3px;
    border-radius: 2px;
}
.ai-epstein-btn {
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    font-weight: 600;
    margin-left: 8px;
}
.ai-epstein-btn:hover { background: #4f46e5; }
.ai-epstein-btn:disabled { opacity: 0.5; cursor: wait; }
.ai-epstein-result {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid #6366f1;
    border-radius: 8px;
}
.ai-epstein-header {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 10px;
}
.ai-epstein-body {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text);
}

.pfizer-exclude-bar {
    margin-bottom: 10px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid #b91c1c;
    border-radius: var(--radius-sm);
}
.pfizer-exclude-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
    font-weight: 500;
}
.pfizer-exclude-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #b91c1c;
    cursor: pointer;
}
.search-syntax-help {
    margin: 8px 0 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.search-syntax-help summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
}
.search-syntax-help summary:hover {
    color: var(--accent);
}
.search-syntax-help ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    list-style: none;
}
.search-syntax-help li {
    white-space: nowrap;
}
.search-syntax-help code {
    background: var(--bg-input);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--accent);
}

.search-meta {
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.share-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.share-link-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}
.share-link-btn.copied {
    color: #22c55e;
    border-color: #22c55e;
}

.result-card {
    background: var(--bg-card);
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 16px 0 20px 0;
    margin-bottom: 0;
    transition: none;
}
.result-card:hover { border-color: var(--border); box-shadow: none; }
.result-header {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.result-source {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary);
}
.result-source::after {
    content: " \00b7";
    color: var(--text-secondary);
}
.result-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.3px;
}
.credibility-badge {
    font-size: 0.7rem;
    padding: 0;
    border-radius: 0;
    font-weight: 500;
    background: none;
}
.credibility-high { color: var(--text-secondary, #9ca3af); }
.credibility-medium { color: var(--text-secondary, #9ca3af); }
.credibility-low { color: var(--danger); }
/* Sponsor disclosure badge */
.sponsor-badge {
    font-size: 0.65rem;
    padding: 0;
    border-radius: 0;
    font-weight: 400;
    font-style: italic;
    background: none;
    color: var(--text-secondary, #9ca3af);
    letter-spacing: 0.02em;
    white-space: nowrap;
}
[data-theme="dark"] .sponsor-badge {
    background: none;
    color: var(--text-secondary, #6b7280);
}

/* --- Subcategory Tabs & Badge --- */
.subcategory-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.subcategory-tab {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--bg-input);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.subcategory-tab:hover {
    color: var(--accent);
    background: var(--accent-glow);
    border-color: var(--accent);
}
.subcategory-tab.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}
.subcategory-badge {
    font-size: 0.62rem;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
    background: rgba(153, 27, 27, 0.1);
    color: #991b1b;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
[data-theme="dark"] .subcategory-badge {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.credibility-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
}
.credibility-dot.credibility-high { background: var(--success); }
.credibility-dot.credibility-medium { background: var(--warning); }
.credibility-dot.credibility-low { background: var(--danger); }
.credibility-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--credibility-help-bg);
    font-size: 0.55rem;
    font-weight: 700;
    cursor: pointer;
    margin-left: 2px;
    vertical-align: middle;
    position: relative;
    color: var(--text-muted);
}
.credibility-disclaimer {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    max-width: 360px;
    z-index: 1000;
    box-shadow: var(--disclaimer-shadow);
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: center;
}
.credibility-disclaimer strong {
    color: var(--text);
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.credibility-disclaimer-close {
    display: inline-block;
    margin-top: 14px;
    padding: 6px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
}
.credibility-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    z-index: 999;
}

.result-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
    line-height: 1.4;
}
.result-title a { color: var(--text); }
.result-title a:hover { color: var(--accent); }
.result-summary {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}
.result-summary mark {
    background: var(--mark-bg);
    color: var(--accent);
    padding: 1px 3px;
    border-radius: 3px;
}
.result-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.result-url { word-break: break-all; }

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 30px 0;
}
.page-link {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.page-link:hover { border-color: var(--accent); color: var(--text); }
.page-link.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); color: white; }
.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-warning { background: rgba(202,138,4,0.1); color: var(--warning); }
.btn-danger { background: rgba(220,38,38,0.1); color: var(--danger); }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-block { display: block; width: 100%; }

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin: 12px 0;
    font-size: 0.9rem;
}
.alert-success { background: rgba(22,163,74,0.08); color: var(--success); border: 1px solid rgba(22,163,74,0.2); }
.alert-error { background: rgba(220,38,38,0.08); color: var(--danger); border: 1px solid rgba(220,38,38,0.2); }
.alert-info { background: rgba(79,70,229,0.08); color: var(--accent); border: 1px solid rgba(79,70,229,0.2); }
.alert-warning { background: rgba(202,138,4,0.08); color: var(--warning); border: 1px solid rgba(202,138,4,0.2); }

/* --- Admin --- */
.admin-login {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}
.login-card h1 { text-align: center; margin-bottom: 24px; }

.admin-page { padding: 30px 0; }
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.stat-card h3 { font-size: 0.85rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 1.8rem; font-weight: 700; margin: 8px 0; }
.stat-ok { color: var(--success); }
.stat-error { color: var(--danger); }
.stat-detail { font-size: 0.85rem; color: var(--text-muted); }

.admin-section {
    margin-bottom: 30px;
}
.admin-section h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}
.action-grid form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.action-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 8px; }
.action-select, .action-input {
    padding: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    margin-bottom: 10px;
    width: 100%;
}

.admin-links {
    display: flex;
    gap: 12px;
}

.category-stats-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.category-stat {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

/* --- Admin Table --- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.admin-table th, .admin-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.admin-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.admin-table tr:hover { background: var(--bg-input); }
.action-buttons { display: flex; gap: 6px; }

/* --- Forms --- */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--accent);
}
.form-group small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.form-group output {
    display: inline-block;
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    color: var(--accent);
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.source-form h3 {
    margin: 24px 0 16px;
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.filter-tag {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.filter-tag:hover, .filter-tag.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

/* --- Empty/Error States --- */
.no-results, .search-prompt, .empty-state, .error-page {
    text-align: center;
    padding: 60px 20px;
}
.no-results h2, .search-prompt h2, .error-page h1 { margin-bottom: 12px; }
.no-results p, .search-prompt p, .error-page p { color: var(--text-secondary); margin-bottom: 20px; }
.no-results-tips { text-align: left; max-width: 420px; margin: 0 auto 24px; }
.no-results-tips ul { margin: 8px 0 0 20px; color: var(--text-secondary); }
.no-results-tips li { margin-bottom: 6px; }
.no-results-tips a { color: var(--accent); }
.error-page h1 { font-size: 4rem; color: var(--accent); }

/* --- About --- */
.about-page { padding: 40px 0; }
.about-page h1 { font-size: 2rem; margin-bottom: 30px; }
.about-section { margin-bottom: 30px; }
.about-section h2 { font-size: 1.3rem; margin-bottom: 12px; color: var(--accent); }
.about-section ul, .about-section ol { margin-left: 20px; }
.about-section li { margin-bottom: 6px; }
.about-section code {
    display: block;
    background: var(--bg-input);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin: 12px 0;
    font-family: monospace;
    color: var(--accent);
    border: 1px solid var(--border);
}

/* --- Footer --- */
.footer {
    background: var(--footer-bg);
    border-top: 1px solid var(--border);
    padding: 40px 0 20px;
    margin-top: 60px;
}
.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}
.footer-brand p { color: var(--text-secondary); font-size: 0.85rem; margin-top: 8px; }
.footer-links h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.footer-links a {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 6px;
}
.footer-links a:hover { color: var(--text); }
.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero-title { font-size: 2rem; }
    .hero { padding: 50px 0 40px; }
    .search-input-group { flex-direction: column; border-radius: var(--radius); }
    .category-select { border-left: none; border-top: 1px solid var(--border); }
    .search-btn { border-radius: 0 0 var(--radius) var(--radius); }
    .footer-content { grid-template-columns: 1fr; gap: 16px; }
    .footer-brand p { font-size: 0.8rem; }
    .footer { margin-top: 30px; padding: 24px 0 16px; }
    .admin-header { flex-direction: column; gap: 12px; }
    .stats-grid { grid-template-columns: 1fr; }
    .admin-table { font-size: 0.8rem; }
    .admin-table th, .admin-table td { padding: 8px; }

    /* Mobile nav: clean single row — hide links (available in footer) */
    .nav-content {
        flex-wrap: nowrap;
        gap: 12px;
    }
    .nav-links {
        display: none; /* links live in footer on mobile */
    }
    .nav-links .theme-toggle {
        /* Keep theme toggle visible on mobile even though nav-links is hidden */
        display: none;
    }
    /* Show a standalone mobile theme toggle in the navbar */
    .mobile-theme-toggle {
        display: flex;
    }
    .nav-search-form {
        flex: 1;
        min-width: 0;
        max-width: none;
    }
    .nav-search-input {
        font-size: 16px; /* prevents iOS zoom on focus */
        padding: 10px 14px;
    }

    /* Homepage: Google-like clean layout */
    .hero {
        padding: 60px 0 30px;
        background: var(--hero-gradient);
    }
    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 24px;
    }
    .categories-section {
        padding: 30px 0;
    }
    .section-title {
        font-size: 1.2rem;
        margin-bottom: 16px;
    }
    .category-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    .category-card {
        padding: 16px 10px;
    }
    .category-card p {
        display: none; /* hide descriptions on mobile — just icon + name */
    }
    .category-card h3 {
        font-size: 0.85rem;
        margin: 8px 0 0;
    }
    .category-icon svg {
        width: 24px;
        height: 24px;
    }

    /* Trending: tighter on mobile */
    .trending-section {
        padding: 20px 0;
    }
    .trending-grid,
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .trending-card {
        padding: 14px;
    }

    /* Thumbnails: smaller on mobile */
    .result-thumb {
        width: 96px;
        height: 64px;
    }

    /* Search page mobile */
    .mobile-back-bar { display: flex; }
    .search-page { padding: 16px 0; }
    .search-controls { padding: 10px; }
    .search-filters { gap: 10px; }
    .filter-group { flex: 1; min-width: 0; }
    .filter-group select,
    .filter-group input[type="date"] { width: 100%; font-size: 16px; }
    .filter-presets { flex-basis: 100%; justify-content: center; }

    /* Result cards */
    .result-card { padding: 14px; }
    .result-title { font-size: 1rem; }
    .result-header { gap: 6px; }
    .result-footer { flex-wrap: wrap; gap: 8px; }
    .result-url { font-size: 0.7rem; flex: 1 1 100%; }

    /* Vote buttons */
    .vote-controls { width: 100%; justify-content: flex-start; margin-left: 0; }
    .vote-btn { padding: 6px 12px; font-size: 0.85rem; }

    /* Submit page */
    .submit-page .form-grid { grid-template-columns: 1fr; }

    /* Pagination */
    .pagination { flex-wrap: wrap; }
    .page-link { padding: 8px 12px; }
}

.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }

/* --- New Category Colors --- */
.category-education .category-icon, .category-tag-education { color: #ec4899; }
.category-environment .category-icon, .category-tag-environment { color: #10b981; }
.category-politics .category-icon, .category-tag-politics { color: #8b5cf6; }
.category-education:hover { border-color: #ec4899; }
.category-environment:hover { border-color: #10b981; }
.category-politics:hover { border-color: #8b5cf6; }
.category-markets .category-icon, .category-tag-markets { color: #f97316; }
.category-markets:hover { border-color: #f97316; }
.category-epstein-files .category-icon, .category-tag-epstein-files { color: #b91c1c; }
.category-epstein-files:hover { border-color: #b91c1c; }
.category-charlie-kirk .category-icon, .category-tag-charlie-kirk { color: #1d4ed8; }
.category-charlie-kirk:hover { border-color: #1d4ed8; }
.category-youtube .category-icon, .category-tag-youtube { color: #FF0000; }
.category-youtube:hover { border-color: #FF0000; }
.category-rumble .category-icon, .category-tag-rumble { color: #85c742; }
.category-rumble:hover { border-color: #85c742; }
.category-legislative .category-icon, .category-tag-legislative { color: #991b1b; }
.category-legislative:hover { border-color: #991b1b; }
.category-state-legislative .category-icon, .category-tag-state-legislative { color: #0e7490; }
.category-state-legislative:hover { border-color: #0e7490; }

/* --- Search Suggestions Dropdown --- */
.suggestions-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 300px;
    overflow-y: auto;
    z-index: 200;
    box-shadow: var(--shadow-lg);
}
.suggestion-item {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    transition: background 0.15s;
}
.suggestion-item:hover {
    background: var(--bg-input);
    color: var(--accent);
}
.suggestion-title {
    display: block;
    font-size: 0.9rem;
    line-height: 1.3;
}
.suggestion-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- Category Page --- */
.category-page { padding: 30px 0; }
.category-header {
    text-align: center;
    margin-bottom: 40px;
}
.category-header h1 { font-size: 2rem; margin-bottom: 8px; }
.category-header p { color: var(--text-secondary); margin-bottom: 24px; }
.category-search { max-width: 600px; margin: 0 auto; }
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}
.badge-primary { background: rgba(79,70,229,0.1); color: var(--accent); }
.badge-info { background: rgba(8,145,178,0.1); color: #0891b2; }
.badge-success { background: rgba(22,163,74,0.08); color: var(--success); }
.badge-warning { background: rgba(202,138,4,0.08); color: var(--warning); }
.badge-danger { background: rgba(220,38,38,0.08); color: var(--danger); }

/* --- Submit Source Page --- */
.submit-page { padding: 40px 0; }
.submit-page h1 { font-size: 2rem; margin-bottom: 12px; }
.submit-intro { color: var(--text-secondary); margin-bottom: 30px; font-size: 1rem; }
.submit-page .source-form { max-width: 700px; }
.submit-page textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
}
.submit-page textarea:focus { border-color: var(--accent); }
.submit-url-input {
    font-size: 1.1rem !important;
    padding: 14px 18px !important;
}

/* --- Vote Controls --- */
.vote-controls {
    display: inline-flex;
    gap: 8px;
    margin-left: auto;
}
.vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}
.vote-btn:hover { border-color: var(--accent); color: var(--text); }
.vote-btn.voted.vote-up { border-color: var(--success); color: var(--success); background: rgba(22,163,74,0.06); }
.vote-btn.voted.vote-down { border-color: var(--danger); color: var(--danger); background: rgba(220,38,38,0.06); }
.vote-count { font-weight: 600; }

/* --- Status Badges (submissions) --- */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-pending { background: rgba(202,138,4,0.08); color: var(--warning); }
.status-approved { background: rgba(22,163,74,0.08); color: var(--success); }
.status-rejected { background: rgba(220,38,38,0.08); color: var(--danger); }
.btn-success { background: rgba(22,163,74,0.1); color: var(--success); }
.btn-success:hover { background: rgba(22,163,74,0.18); }
.actions-cell { white-space: nowrap; }

/* --- About Editor --- */
.about-editor {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
    line-height: 1.6;
}
.about-editor:focus { border-color: var(--accent); }

/* --- Enhanced Search Glow --- */
@keyframes enhanced-glow {
    0%, 100% { box-shadow: 0 0 6px rgba(22, 163, 74, 0.25), 0 0 16px rgba(22, 163, 74, 0.1); }
    50% { box-shadow: 0 0 10px rgba(22, 163, 74, 0.35), 0 0 24px rgba(22, 163, 74, 0.15); }
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.3); }
}
.enhanced-glow {
    border-color: var(--success) !important;
    animation: enhanced-glow 2.5s ease-in-out infinite;
}
.enhanced-active {
    position: relative;
}
.enhanced-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--success);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    pointer-events: none;
}
.enhanced-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin-bottom: 16px;
    background: rgba(22, 163, 74, 0.06);
    border: 1px solid rgba(22, 163, 74, 0.18);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--success);
    font-weight: 500;
}
.enhanced-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
    flex-shrink: 0;
}
.enhanced-sources {
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: auto;
    font-size: 0.8rem;
}
.enhanced-result {
    border-left: none !important;
}
.enhanced-badge {
    font-size: 0.65rem;
    font-weight: 400;
    font-style: italic;
    color: var(--text-secondary, #9ca3af);
    background: none;
    padding: 0;
    border-radius: 0;
    text-transform: none;
    letter-spacing: 0;
}

/* --- Web Fallback Banner --- */
.web-fallback-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: rgba(37, 99, 235, 0.05);
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--news);
    font-weight: 500;
}
.web-fallback-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}
.web-fallback-note {
    color: var(--text-muted);
    font-weight: 400;
    margin-left: auto;
    font-size: 0.78rem;
}
.web-result-badge {
    background: rgba(37, 99, 235, 0.08) !important;
    color: var(--news) !important;
}
.grokipedia-badge {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #10b981 !important;
}
.polymarket-badge {
    background: rgba(99, 102, 241, 0.1) !important;
    color: #6366f1 !important;
}

/* Polymarket odds display */
.polymarket-odds {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
    align-items: center;
}
.polymarket-outcome {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    overflow: hidden;
    z-index: 1;
}
.polymarket-outcome .outcome-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: rgba(99, 102, 241, 0.08);
    z-index: -1;
    border-radius: 6px;
    transition: width 0.3s ease;
}
.polymarket-outcome.outcome-leading {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}
.polymarket-outcome.outcome-leading .outcome-bar {
    background: rgba(99, 102, 241, 0.15);
}
.outcome-label {
    color: var(--text-secondary, #aaa);
}
.outcome-pct {
    font-weight: 700;
    color: #6366f1;
}
.polymarket-outcome.outcome-leading .outcome-pct {
    color: #818cf8;
}
.polymarket-volume {
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
    margin-left: 4px;
}
/* --- Polls Category --- */
.polls-page .section-title { margin-top: 30px; }
.polls-table-wrap {
    overflow-x: auto;
    margin: 16px 0;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.polls-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.polls-table th {
    background: var(--bg-card);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.polls-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}
.polls-table tbody tr:hover { background: rgba(99, 102, 241, 0.04); }
.poll-pollster { font-weight: 500; }
.pollster-aapor { color: #f59e0b; font-weight: 700; }
.pollster-grade {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}
.grade-a { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.grade-b { background: rgba(234, 179, 8, 0.15); color: #eab308; }
.grade-c { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.grade-nr { background: rgba(107, 114, 128, 0.15); color: #6b7280; }
.poll-date { white-space: nowrap; color: var(--text-muted); }
.poll-race { white-space: nowrap; }
.cand-name { font-weight: 500; }
.party-dem { color: #3b82f6; }
.party-rep { color: #ef4444; }
.party-ind { color: #f59e0b; }
.cand-pct { font-weight: 700; margin-left: 4px; }
.poll-margin { font-weight: 700; white-space: nowrap; }
.margin-pos { color: #3b82f6; }
.margin-neg { color: #ef4444; }
.poll-sample { color: var(--text-muted); }
.no-data { color: var(--text-muted); text-align: center; padding: 20px; }

/* Map section */
.polls-map-section { margin: 30px 0; }
.polls-map-container {
    max-width: 800px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
    padding: 16px;
}
.polls-map-container object { display: block; width: 100%; height: auto; }
.polls-map-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

/* State detail */
.state-poll-detail {
    margin: 24px 0;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}
.state-detail-header { margin-bottom: 16px; }
.state-poll-detail h2 { margin: 8px 0 0; }
.state-poll-detail h3 { margin: 0 0 8px; }
.state-back-link {
    font-size: 0.85rem;
    color: #818cf8;
    text-decoration: none;
}
.state-back-link:hover { text-decoration: underline; }

/* State grid */
.state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 16px;
}
.state-card {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s;
}
.state-card:hover { border-color: #818cf8; }
.state-abbrev { font-weight: 700; font-size: 1.1rem; }
.state-name { font-size: 0.82rem; color: var(--text-secondary); }
.state-poll-count { font-size: 0.75rem; color: var(--text-muted); }

/* Poll race groups (collapsible) */
.poll-race-group {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-card);
}
.poll-race-group[open] { border-color: rgba(139, 92, 246, 0.3); }
.poll-race-header {
    padding: 14px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    list-style: none;
}
.poll-race-header::-webkit-details-marker { display: none; }
.poll-race-header::marker { content: ""; }
.poll-race-title { font-weight: 600; font-size: 1rem; }
.poll-race-avg { font-size: 0.88rem; display: flex; gap: 6px; align-items: center; }
.poll-vs { color: var(--text-muted); font-size: 0.8rem; }
.poll-avg-row { background: rgba(139, 92, 246, 0.05); font-weight: 600; }

/* Polls vs Markets comparison */
.polls-vs-markets { margin: 30px 0; }
.section-desc { text-align: center; color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 16px; }
.pvm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}
.pvm-card {
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.pvm-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.pvm-title { font-weight: 600; font-size: 0.92rem; }

/* --- Auth Pages --- */
.auth-page { padding: 60px 0; display: flex; justify-content: center; }
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px;
    width: 100%;
    max-width: 440px;
}
.auth-card-wide { max-width: 600px; }
.auth-card h1 { font-size: 1.6rem; margin: 0 0 8px; }
.auth-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
.form-group .optional { font-weight: 400; color: var(--text-muted); font-size: 0.8rem; }
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"],
.form-group select {
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.form-check { flex-direction: row; align-items: center; gap: 8px; font-size: 0.88rem; }
.form-check input[type="checkbox"] { width: 18px; height: 18px; }
.auth-btn {
    padding: 12px 24px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}
.auth-btn:hover { background: #4f46e5; }
.auth-btn-secondary { background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.auth-btn-secondary:hover { background: var(--border); }
.auth-links { margin-top: 20px; text-align: center; font-size: 0.88rem; color: var(--text-muted); }
.auth-links a { color: #818cf8; }
.auth-link-muted { color: var(--text-muted); font-size: 0.85rem; }
.flash-msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 0.88rem; }
.flash-success { background: rgba(34, 197, 94, 0.1); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.2); }
.flash-error { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.flash-info { background: rgba(99, 102, 241, 0.1); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.2); }
.settings-section { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.settings-section h2 { font-size: 1.1rem; margin: 0 0 4px; }
.settings-desc { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 16px; }
.provider-help { margin-bottom: 12px; }
.provider-help summary { font-size: 0.85rem; color: #818cf8; cursor: pointer; }
.provider-instructions { font-size: 0.82rem; color: var(--text-secondary); padding: 8px 0; }
.provider-instructions p { margin: 4px 0; }
.nav-user-link { font-weight: 500; }
.terms-content { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }
.terms-content h3 { color: var(--text); margin: 20px 0 8px; }
.terms-content ul { padding-left: 20px; }
.terms-agree-form { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }

/* --- AI Article Analysis Button & Panel --- */
.ai-analyze-wrap {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-right: 8px;
}
.ai-analyze-btn {
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.ai-analyze-btn:hover { background: rgba(99, 102, 241, 0.25); }
.ai-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: help;
    transition: color 0.2s;
}
.ai-help-icon:hover { color: #818cf8; border-color: #818cf8; }
.ai-analysis-panel {
    margin: 10px 0;
    padding: 14px;
    background: rgba(99, 102, 241, 0.04);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    font-size: 0.88rem;
    line-height: 1.6;
}
.ai-loading { color: #818cf8; font-style: italic; }
.ai-error { color: #ef4444; }
.ai-login-prompt { text-align: center; }
.ai-login-prompt p { margin-bottom: 12px; color: var(--text-secondary); }
.ai-analysis-result { display: flex; flex-direction: column; gap: 8px; }
.ai-section { color: var(--text-secondary); }
.ai-section strong { color: var(--text); }
.ai-section ul { padding-left: 18px; margin: 4px 0; }
.ai-sentiment {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
}
.sentiment-positive { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.sentiment-negative { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.sentiment-neutral { background: rgba(107, 114, 128, 0.12); color: #9ca3af; }
.sentiment-mixed { background: rgba(234, 179, 8, 0.12); color: #eab308; }

.category-tag-polls { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }

.category-tag-polymarket {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

/* --- Prediction Markets: Collapsible Topic Cards --- */
.pm-topics {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.pm-topic {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.pm-topic[open] {
    border-color: rgba(99, 102, 241, 0.3);
}
.pm-topic-header {
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.pm-topic-header::-webkit-details-marker {
    display: none;
}
.pm-topic-header::marker {
    display: none;
    content: "";
}
.pm-topic-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.pm-expand-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    position: relative;
    transition: transform 0.2s, background 0.2s;
}
.pm-expand-icon::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 4px solid transparent;
    border-left: 6px solid #6366f1;
    margin-left: 2px;
}
.pm-topic[open] .pm-expand-icon {
    transform: rotate(90deg);
    background: rgba(99, 102, 241, 0.2);
}
.pm-topic-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
    color: var(--text);
}
.pm-source-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    white-space: nowrap;
}
.pm-source-manifold {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}
.pm-source-predictit {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}
.pm-topic-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding-left: 30px;
    flex-wrap: wrap;
}
.pm-topic[open] .pm-topic-preview {
    display: none;
}
.pm-topic-body {
    padding: 0 20px 20px;
    border-top: 1px solid var(--border);
}
.pm-topic-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 12px 0 0;
    line-height: 1.5;
}
.pm-topic-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    font-size: 0.82rem;
}
.pm-view-link {
    color: #818cf8;
    text-decoration: none;
    font-weight: 600;
    padding: 4px 12px;
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 6px;
    transition: background 0.2s;
}
.pm-view-link:hover {
    background: rgba(99, 102, 241, 0.1);
}
.pm-topic-footer .date {
    color: var(--text-muted);
}

/* Source section headers */
.pm-source-section {
    margin-bottom: 28px;
}
.pm-source-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.pm-source-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.pm-source-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* Hover effect on collapsed topic */
.pm-topic:not([open]):hover {
    border-color: rgba(99, 102, 241, 0.2);
}
.pm-topic:not([open]):hover .pm-topic-title {
    color: #818cf8;
}

@media (max-width: 768px) {
    .pm-topic-header { padding: 12px 14px; }
    .pm-topic-body { padding: 0 14px 14px; }
    .pm-topic-title { font-size: 0.95rem; }
    .pm-topic-preview { padding-left: 0; }

    /* Subcategory tabs: horizontal scroll on mobile */
    .subcategory-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        gap: 6px;
    }
    .subcategory-tab { flex-shrink: 0; font-size: 0.8rem; padding: 5px 12px; }

    /* Polls table: scroll horizontally */
    .polls-table { font-size: 0.78rem; }
    .polls-table th, .polls-table td { padding: 6px 8px; }
    .poll-race-header { flex-wrap: wrap; gap: 6px; padding: 10px 14px; }
    .poll-race-avg { font-size: 0.8rem; }

    /* State grid: 2 columns on mobile */
    .state-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .state-card { padding: 8px 10px; }

    /* Polls map */
    .polls-map-container { padding: 8px; }
    .polls-map-legend { gap: 8px; font-size: 0.72rem; }

    /* PVM grid: single column */
    .pvm-grid { grid-template-columns: 1fr; }
    .pvm-card { padding: 10px 14px; }

    /* Auth pages */
    .auth-page { padding: 30px 16px; }
    .auth-card { padding: 24px 20px; }
    .auth-card h1 { font-size: 1.3rem; }

    /* AI analysis panel */
    .ai-analysis-panel { padding: 10px; font-size: 0.82rem; }

    /* Polymarket embeds: single column on mobile */
    .polymarket-embeds { grid-template-columns: 1fr; }

    /* Source section headers */
    .pm-source-header { flex-wrap: wrap; gap: 6px; }

    /* Featured links below search */
    .hero-featured { gap: 8px; }
    .featured-polymarket-link, .featured-polls-link { padding: 6px 14px; font-size: 0.82rem; }

    /* Polymarket odds: wrap tighter */
    .polymarket-odds { gap: 4px; }
    .polymarket-outcome { padding: 3px 8px; font-size: 0.78rem; }
}

/* Polymarket embed iframes */
.polymarket-embeds {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 8px;
    margin: 10px 0;
}
.polymarket-embed-wrap {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(99, 102, 241, 0.15);
}
.polymarket-embed-wrap iframe {
    display: block;
    max-width: 100%;
    border-radius: 8px;
}
.grok-read-more-btn {
    font-size: 0.78rem;
    color: var(--accent, #4f8cff);
    text-decoration: none;
    border: 1px solid rgba(79, 140, 255, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}
.grok-read-more-btn:hover {
    background: rgba(79, 140, 255, 0.1);
}
.grok-suggest-btn {
    font-size: 0.78rem;
    color: #10b981;
    text-decoration: none;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
}
.grok-suggest-btn:hover {
    background: rgba(16, 185, 129, 0.1);
}

/* Hide enhanced indicator on small screens, show banner instead */
@media (max-width: 768px) {
    .enhanced-indicator { display: none; }
    .enhanced-banner { font-size: 0.78rem; flex-wrap: wrap; }
    .enhanced-sources { margin-left: 0; width: 100%; }
    .web-fallback-banner { flex-wrap: wrap; font-size: 0.8rem; }
    .web-fallback-note { margin-left: 0; width: 100%; }
}
.web-promoted-banner {
    background: rgba(234, 179, 8, 0.08);
    border-color: rgba(234, 179, 8, 0.3);
}

/* --- Admin Source Search Bar --- */
.source-search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.source-search-input {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.source-search-input:focus { border-color: var(--accent); }
.source-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* --- AI Analyze URL Page --- */
.ai-insights-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 28px;
}
.ai-insights-panel h3 {
    color: var(--accent);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ai-insights-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.ai-insight-block label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.ai-insight-block p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.ai-key-points {
    list-style: none;
    padding: 0;
}
.ai-key-points li {
    font-size: 0.88rem;
    color: var(--text-secondary);
    padding: 6px 0 6px 18px;
    position: relative;
    line-height: 1.5;
    border-bottom: 1px solid var(--border);
}
.ai-key-points li:last-child { border-bottom: none; }
.ai-key-points li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 13px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}
.ai-insight-row {
    display: flex;
    gap: 24px;
}
.ai-insight-row .ai-insight-block { flex: 1; }
.analyze-form .form-control-lg {
    font-size: 1rem;
    padding: 12px 16px;
}
.analyze-form textarea.form-control-lg {
    min-height: 120px;
    line-height: 1.6;
}
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.btn-lg {
    padding: 12px 32px;
    font-size: 1rem;
}
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}
@media (max-width: 768px) {
    .form-row-2 { grid-template-columns: 1fr; }
    .ai-insight-row { flex-direction: column; gap: 12px; }
}

/* --- Theme Toggle Switch --- */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}
.theme-toggle-track {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: background 0.3s, border-color 0.3s;
}
.theme-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    transition: transform 0.3s;
}
[data-theme="dark"] .theme-toggle-track::after {
    transform: translateX(20px);
}
.theme-toggle-icon {
    font-size: 0.95rem;
    line-height: 1;
}

/* Mobile theme toggle - hidden on desktop, shown on mobile */
.mobile-theme-toggle {
    display: none;
}

/* Smooth color transitions when switching themes */
body,
.navbar,
.hero,
.footer,
.result-card,
.category-card,
.trending-card,
.search-controls,
.stat-card,
.login-card,
.action-grid form,
.suggestions-dropdown,
.suggestion-item,
.page-link,
.filter-tag,
.credibility-disclaimer,
.ai-insights-panel,
.about-section code,
.category-stat,
.btn,
.alert,
.badge,
.status-badge,
.vote-btn {
    transition: background 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* --- Historical Crawl Page --- */
.btn-accent {
    background: var(--accent);
    color: #fff;
    border: none;
}
.btn-accent:hover {
    background: var(--accent-hover);
    color: #fff;
}

.historical-source-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
}
.historical-source-info h2 {
    margin-bottom: 4px;
    font-size: 1.3rem;
}
.historical-source-info .source-meta {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    align-items: center;
}

.historical-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}
.historical-form-card h3 {
    margin-bottom: 6px;
    font-size: 1.1rem;
}

.historical-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin: 20px 0;
}
.historical-form-grid .form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
}
.historical-form-grid .form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.95rem;
}
.historical-form-grid small {
    display: block;
    margin-top: 4px;
}

.btn-lg {
    padding: 12px 32px;
    font-size: 1rem;
}

/* Progress section */
.historical-progress {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}
.historical-progress h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}
.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 0;
}

.progress-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    word-break: break-all;
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.stat-item {
    text-align: center;
    padding: 12px 8px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}
.stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}
.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.stat-success .stat-value { color: var(--success); }
.stat-error .stat-value { color: var(--danger); }

.progress-complete {
    background: rgba(22, 163, 74, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    text-align: center;
}
.progress-error {
    background: rgba(220, 38, 38, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

/* Info section */
.historical-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.historical-info h3 {
    margin-bottom: 12px;
    font-size: 1.1rem;
}
.historical-info ol {
    padding-left: 20px;
    margin-bottom: 12px;
}
.historical-info li {
    margin-bottom: 8px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.historical-info code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .historical-form-grid {
        grid-template-columns: 1fr;
    }
    .progress-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Dark theme color-scheme for native elements */
[data-theme="dark"] {
    color-scheme: dark;
}
[data-theme="dark"] .category-select,
[data-theme="dark"] .filter-group select,
[data-theme="dark"] .action-select {
    color-scheme: dark;
}

/* Admin inline credibility editor */
.admin-editable-cred {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    cursor: default;
}
.admin-editable-cred .cred-input {
    width: 36px;
    padding: 0 2px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    -moz-appearance: textfield;
}
.admin-editable-cred .cred-input::-webkit-inner-spin-button,
.admin-editable-cred .cred-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.admin-editable-cred .cred-label {
    font-size: 0.7rem;
}
.admin-editable-cred .cred-save-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    color: inherit;
    font-size: 0.65rem;
    padding: 0 4px;
    cursor: pointer;
    line-height: 1.4;
    opacity: 0.7;
}
.admin-editable-cred .cred-save-btn:hover {
    opacity: 1;
    background: rgba(255,255,255,0.1);
}
.admin-editable-cred .cred-save-btn.saved {
    color: #4caf50;
    opacity: 1;
}

/* Admin boost promote/demote controls */
.admin-boost-controls {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 0.75rem;
    vertical-align: middle;
}
.boost-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 5px;
    line-height: 1;
    transition: color 0.15s;
}
.boost-btn:hover {
    color: #fff;
}
.boost-up:hover { color: #4caf50; }
.boost-down:hover { color: #f44336; }
.boost-value {
    font-weight: 600;
    min-width: 18px;
    text-align: center;
    font-size: 0.75rem;
}
.boost-value.positive { color: #4caf50; }
.boost-value.negative { color: #f44336; }
.boost-value.neutral { color: rgba(255,255,255,0.5); }

/* =========================================
   NewsRoom Bob
   ========================================= */

/* Bob Write This button */
.bob-write-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.bob-write-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}
.bob-write-btn.bob-working {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    animation: bob-pulse 1.5s ease-in-out infinite;
    cursor: wait;
}
.bob-write-btn.bob-done {
    background: linear-gradient(135deg, #10b981, #22c55e);
    cursor: pointer;
}
@keyframes bob-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Article thumbnails — images loaded from source CDNs, not stored locally */
.result-card.has-thumb,
.trending-card.has-thumb {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.result-thumb {
    flex-shrink: 0;
    width: 120px;
    height: 80px;
    border-radius: var(--radius, 6px);
    overflow: hidden;
    background: var(--bg-secondary, #1e293b);
    aspect-ratio: 3 / 2;
}
.result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.result-card.has-thumb .result-body,
.trending-card.has-thumb .result-body {
    flex: 1;
    min-width: 0;
}
@media (max-width: 480px) {
    .result-thumb {
        width: 72px;
        height: 48px;
    }
}

/* Source Notes (credibility notes on content sources) */
.source-note-wrapper {
    display: inline-block;
    position: relative;
    vertical-align: middle;
    margin-left: 4px;
}
.source-note-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    font-size: 10px;
    cursor: pointer;
    line-height: 1;
    vertical-align: middle;
}
.source-note-badge.source-stance-trustworthy {
    background: #10b981;
    color: #fff;
}
.source-note-badge.source-stance-caution {
    background: #f59e0b;
    color: #000;
}
.source-note-badge.source-stance-neutral {
    background: var(--text-muted, #475569);
    color: #fff;
}
.srcnote-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px dashed var(--text-muted, #475569);
    background: none;
    color: var(--text-muted, #475569);
    font-size: 10px;
    cursor: pointer;
    vertical-align: middle;
}
.srcnote-add-btn:hover {
    border-color: #f59e0b;
    color: #f59e0b;
}
.source-note-popup {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    width: 320px;
    background: var(--bg, #0f172a);
    border: 1px solid var(--border, #334155);
    border-radius: var(--radius, 6px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    padding: 0.75rem;
    margin-top: 4px;
}
.source-note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.source-note-stance-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 3px;
}
.source-note-stance-label.source-stance-trustworthy {
    background: #10b981;
    color: #fff;
}
.source-note-stance-label.source-stance-caution {
    background: #f59e0b;
    color: #000;
}
.source-note-stance-label.source-stance-neutral {
    background: var(--text-muted, #475569);
    color: #fff;
}
.source-note-close {
    background: none;
    border: none;
    color: var(--text-muted, #475569);
    font-size: 1.1rem;
    cursor: pointer;
}
.source-note-body {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 0.5rem;
}
.source-note-admin-controls {
    display: flex;
    gap: 0.5rem;
    border-top: 1px solid var(--border, #334155);
    padding-top: 0.5rem;
}
.source-note-admin-controls button {
    background: none;
    border: 1px solid var(--border, #334155);
    color: var(--text-muted, #475569);
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
}
.source-note-admin-controls button:hover {
    color: var(--text, #f1f5f9);
    border-color: var(--text-muted, #475569);
}
/* Source note editor (admin) */
.srcnote-editor {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 110;
    width: 380px;
    background: var(--bg, #0f172a);
    border: 1px solid #f59e0b;
    border-radius: var(--radius, 6px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    padding: 0.75rem;
    margin-top: 4px;
}
.srcnote-editor-title {
    font-weight: 700;
    font-size: 0.8rem;
    color: #f59e0b;
    margin-bottom: 0.5rem;
}
.srcnote-textarea {
    width: 100%;
    min-height: 80px;
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--border, #334155);
    color: var(--text, #f1f5f9);
    border-radius: var(--radius, 6px);
    padding: 0.5rem;
    font-size: 0.82rem;
    font-family: inherit;
    resize: vertical;
}
.srcnote-textarea:focus {
    outline: none;
    border-color: #f59e0b;
}
.srcnote-stance-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.4rem 0;
    font-size: 0.75rem;
    color: var(--text-secondary, #94a3b8);
}
.srcnote-stance {
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--border, #334155);
    color: var(--text, #f1f5f9);
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.75rem;
}
.srcnote-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.4rem;
}
.srcnote-save {
    background: #f59e0b;
    color: #000;
    border: none;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}
.srcnote-save:hover { background: #d97706; }
.srcnote-research {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}
.srcnote-research:hover { opacity: 0.9; }
.srcnote-research-claim {
    background: linear-gradient(135deg, #ec4899, #f43f5e);
    color: #fff;
    border: none;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}
.srcnote-research-claim:hover { opacity: 0.9; }
.srcnote-cancel {
    background: none;
    border: 1px solid var(--border, #334155);
    color: var(--text-muted, #475569);
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 0.72rem;
    cursor: pointer;
}
.srcnote-cancel:hover { color: var(--text, #f1f5f9); }
.srcnote-guidance-row {
    margin: 0.4rem 0;
}
.srcnote-guidance-row label {
    display: block;
    font-size: 0.72rem;
    color: #8b5cf6;
    font-weight: 600;
    margin-bottom: 2px;
}
.srcnote-guidance-row label small {
    font-weight: 400;
    color: var(--text-muted, #475569);
}
.srcnote-guidance {
    width: 100%;
    min-height: 38px;
    background: var(--bg-secondary, #1e293b);
    border: 1px solid #6366f1;
    color: var(--text, #f1f5f9);
    border-radius: var(--radius, 6px);
    padding: 0.4rem;
    font-size: 0.78rem;
    font-family: inherit;
    resize: vertical;
}
.srcnote-guidance:focus {
    outline: none;
    border-color: #8b5cf6;
}
.srcnote-guidelines-hint {
    margin-top: 0.4rem;
    font-size: 0.68rem;
    color: var(--text-muted, #475569);
}
.srcnote-guidelines-hint a {
    color: #6366f1;
    text-decoration: underline;
}

/* NewsRoom Notes */
.newsroom-note-wrapper {
    margin: 0.5rem 0;
}
.newsroom-note {
    background: var(--bg-secondary, #1e293b);
    border-left: 3px solid #f59e0b;
    padding: 0.5rem 0.75rem;
    border-radius: 0 var(--radius, 6px) var(--radius, 6px) 0;
    font-size: 0.85rem;
    line-height: 1.5;
}
.newsroom-note-label {
    font-weight: 700;
    color: #f59e0b;
    margin-right: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.newsroom-note-text {
    color: var(--text-secondary, #94a3b8);
}
.newsroom-note-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}
.note-add-btn, .note-edit-btn {
    background: none;
    border: 1px dashed var(--text-muted, #475569);
    color: var(--text-muted, #475569);
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 3px;
    cursor: pointer;
}
.note-add-btn:hover, .note-edit-btn:hover {
    border-color: #f59e0b;
    color: #f59e0b;
}
.note-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted, #475569);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 1px 4px;
}
.note-delete-btn:hover {
    color: #ef4444;
}
.note-editor {
    margin-top: 0.5rem;
}
.note-textarea {
    width: 100%;
    min-height: 60px;
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--border, #334155);
    color: var(--text, #f1f5f9);
    border-radius: var(--radius, 6px);
    padding: 0.5rem;
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
}
.note-textarea:focus {
    outline: none;
    border-color: #f59e0b;
}
.note-editor-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.35rem;
}
.note-save-btn {
    background: #f59e0b;
    color: #000;
    border: none;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}
.note-save-btn:hover { background: #d97706; }
.note-bob-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}
.note-bob-btn:hover { opacity: 0.9; }
.note-cancel-btn {
    background: none;
    border: 1px solid var(--border, #334155);
    color: var(--text-muted, #475569);
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 0.75rem;
    cursor: pointer;
}
.note-cancel-btn:hover { color: var(--text, #f1f5f9); }

/* NewsRoom listing page */
.newsroom-page { padding-top: 1.5rem; }
.newsroom-header {
    text-align: center;
    margin-bottom: 2rem;
}
.newsroom-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}
.newsroom-byline {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Bob story cards */
.bob-story-card .bob-card-image {
    margin: -1rem -1rem 0.75rem -1rem;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
    max-height: 180px;
}
.bob-story-card .bob-card-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

/* Bob story detail page */
.bob-story-page .bob-byline {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.bob-story-page .bob-source-credit {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.bob-content p {
    margin: 0 0 0.75rem 0;
    line-height: 1.7;
    color: var(--text);
    font-size: 1.05rem;
}
.bob-content p:last-child {
    margin-bottom: 0;
}
.bob-original-source {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.bob-source-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* --- Cookie Consent Banner --- */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: var(--bg-card);
    border-top: 2px solid var(--primary);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    padding: 0;
    display: flex;
    justify-content: center;
}
.cookie-banner-inner {
    max-width: 960px;
    width: 100%;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.cookie-banner-text {
    flex: 1;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text);
}
.cookie-banner-text p {
    margin: 0 0 6px;
}
.cookie-banner-legal {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.cookie-banner-legal a {
    color: var(--primary);
}
.cookie-banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
.cookie-btn {
    padding: 10px 22px;
    font-size: 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}
@media (max-width: 640px) {
    .cookie-banner-inner {
        flex-direction: column;
        padding: 16px;
        gap: 14px;
    }
    .cookie-banner-actions {
        width: 100%;
    }
    .cookie-btn {
        flex: 1;
    }
}
.footer-privacy {
    margin-top: 6px;
    font-size: 0.82rem;
}
.footer-privacy a {
    color: var(--text-muted);
    text-decoration: underline;
}

/* --- Analytics page --- */
.analytics-period {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.analytics-chart {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.chart-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.chart-label {
    width: 90px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}
.chart-bar-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    height: 26px;
    overflow: hidden;
    position: relative;
}
.chart-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 4px 0 0 4px;
    min-width: 2px;
    transition: width 0.3s ease;
}
.chart-value {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding-right: 8px;
    white-space: nowrap;
}

/* AI Answer Box */
.ai-answer-box {
    background: var(--card-bg);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.08);
}
.ai-answer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.ai-answer-icon {
    font-size: 1.3rem;
    display: inline-flex;
    align-items: center;
    color: var(--accent);
}
.ai-answer-label {
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent);
}
.ai-answer-remaining {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}
.ai-answer-content {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text-primary);
}
.ai-loading {
    color: var(--text-muted);
    font-style: italic;
}

/* =========================================
   Local Business Panel + Cards
   ========================================= */

.search-layout {
    display: block;
}
.search-layout.has-business-panel {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}
.search-layout.has-business-panel .search-results {
    flex: 1;
    min-width: 0;
}

.business-panel {
    width: 320px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}
.business-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.business-panel-icon {
    font-size: 1.1rem;
}
.business-panel-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}
.business-panel-location {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: auto;
}
.loc-change-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 0.25rem;
}
.loc-set-btn {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
}
.loc-set-btn:hover {
    background: var(--accent-hover);
}

/* Business card */
.business-card {
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
}
.business-card:last-of-type {
    border-bottom: none;
}
.biz-name-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}
.biz-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}
.biz-name a {
    color: var(--accent);
    text-decoration: none;
}
.biz-name a:hover {
    text-decoration: underline;
}
.biz-distance {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.biz-type-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 99px;
    background: var(--accent-glow);
    color: var(--accent);
    margin: 0.25rem 0;
}
.biz-cat-food .biz-type-badge, .biz-type-badge.biz-cat-food { background: rgba(220, 38, 38, 0.08); color: #dc2626; }
.biz-cat-health .biz-type-badge, .biz-type-badge.biz-cat-health { background: rgba(22, 163, 74, 0.08); color: #16a34a; }
.biz-cat-shopping .biz-type-badge, .biz-type-badge.biz-cat-shopping { background: rgba(37, 99, 235, 0.08); color: #2563eb; }
.biz-cat-automotive .biz-type-badge, .biz-type-badge.biz-cat-automotive { background: rgba(217, 119, 6, 0.08); color: #d97706; }
.biz-cat-professional .biz-type-badge, .biz-type-badge.biz-cat-professional { background: rgba(147, 51, 234, 0.08); color: #9333ea; }
.biz-cat-craft .biz-type-badge, .biz-type-badge.biz-cat-craft { background: rgba(217, 119, 6, 0.08); color: #d97706; }

.biz-address, .biz-phone, .biz-hours {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0.2rem 0;
    line-height: 1.4;
}
.biz-phone a {
    color: var(--text-secondary);
    text-decoration: none;
}
.biz-phone a:hover {
    color: var(--accent);
}
.biz-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}
.biz-directions-btn, .biz-website-btn {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    background: transparent;
}
.biz-directions-btn:hover, .biz-website-btn:hover {
    background: var(--accent-glow);
    color: var(--accent);
    border-color: var(--accent);
}
.biz-attribution {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    text-align: center;
}
.biz-attribution a {
    color: var(--text-muted);
    text-decoration: underline;
}

/* Location prompt modal */
.location-prompt {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.location-prompt-inner {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 380px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.location-prompt-inner h3 {
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
    color: var(--text);
}
.loc-gps-btn {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 1rem;
}
.loc-gps-btn:hover {
    background: var(--accent-hover);
}
.loc-divider {
    position: relative;
    text-align: center;
    margin: 1rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.loc-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}
.loc-divider span {
    position: relative;
    background: var(--bg-card);
    padding: 0 0.75rem;
}
.loc-zip-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.loc-zip-input {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: var(--bg-input);
    color: var(--text);
    text-align: center;
}
.loc-zip-btn {
    padding: 0.6rem 1.25rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    cursor: pointer;
}
.loc-skip-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
}
.loc-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Mobile: business panel stacks above results */
@media (max-width: 900px) {
    .search-layout.has-business-panel {
        flex-direction: column-reverse;
    }
    .business-panel {
        width: 100%;
        position: static;
        max-height: none;
        margin-bottom: 1rem;
    }
}

/* =========================================
   Analytics Dashboard - Day Drilldown
   ========================================= */
.chart-row-clickable {
    cursor: pointer;
    transition: background 0.15s;
    border-radius: var(--radius-sm);
    padding: 2px 4px;
}
.chart-row-clickable:hover {
    background: var(--accent-glow);
}
.chart-row-clickable.active {
    background: var(--accent-glow);
    border-left: 3px solid var(--accent);
}

.day-detail-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 1rem;
    box-shadow: var(--shadow);
}
.day-detail-panel h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.metrics-mini-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.mini-card {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    text-align: center;
}
.mini-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.mini-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
}

.detail-section {
    margin-bottom: 1.25rem;
}
.detail-section h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stacked-bar {
    display: flex;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.3rem;
}
.stacked-seg {
    min-width: 2px;
    transition: width 0.3s;
}
.stacked-labels {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
}

.hourly-chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 80px;
    padding-bottom: 18px;
    position: relative;
}
.hourly-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    position: relative;
}
.hourly-bar {
    width: 100%;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    min-height: 1px;
    transition: height 0.3s;
}
.hourly-label {
    position: absolute;
    bottom: -16px;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.detail-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.mini-table {
    font-size: 0.85rem;
}
.mini-table td:last-child {
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .metrics-mini-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .detail-columns {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   Related Stories
   ========================================= */
.related-stories {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.related-stories h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}
.related-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.15s;
}
.related-card:hover {
    box-shadow: var(--shadow);
}
.related-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}
.related-info {
    padding: 0.75rem;
}
.related-source {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.related-info h3 {
    font-size: 0.9rem;
    margin-top: 0.25rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.article-hero-image img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
}

/* --- Epstein document cards --- */
.document-card {
    border-left: 3px solid #b91c1c;
}
.doc-badge {
    background: #b91c1c;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.bates-badge {
    background: var(--bg-tertiary, #374151);
    color: var(--text-secondary, #9ca3af);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-family: monospace;
}
.doc-meta-item {
    margin-right: 12px;
    color: var(--text-secondary, #9ca3af);
    font-size: 0.8rem;
}
.doc-meta-item::before {
    content: "·";
    margin-right: 4px;
}
.doc-meta-item:first-child::before {
    content: "";
    margin-right: 0;
}
.doj-link {
    color: var(--accent, #3b82f6);
    font-size: 0.8rem;
    text-decoration: none;
}
.doj-link:hover {
    text-decoration: underline;
}
.download-pdf-btn {
    display: inline-block;
    background: #059669;
    color: #fff !important;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 600;
    margin-left: 8px;
}
.download-pdf-btn:hover {
    background: #047857;
    text-decoration: none;
}
.download-pdf-link {
    color: #059669;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    margin-left: 8px;
}
.download-pdf-link:hover {
    text-decoration: underline;
}
/* Document viewer page */
.doc-viewer-content {
    white-space: pre-wrap;
    font-family: 'Georgia', serif;
    line-height: 1.7;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--bg-secondary, #1f2937);
    color: var(--text, #e8e8ed);
    border-radius: 8px;
    font-size: 0.95rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.doc-viewer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border, #374151);
}

/* --- Search Tabs --- */
.search-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.search-tab {
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.15s;
}
.search-tab:hover {
    color: var(--text-primary);
}
.search-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* --- Image Grid (Images + Shopping tabs) --- */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 2rem;
}
.image-grid-item {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.image-grid-item:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.image-grid-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: var(--bg-secondary);
}
.image-caption {
    padding: 6px 8px 4px;
    font-size: 0.75rem;
    color: var(--text-primary);
    line-height: 1.3;
}
.image-source {
    padding: 0 8px 6px;
    font-size: 0.65rem;
    color: var(--text-secondary);
}
.image-price {
    position: absolute;
    bottom: 40px;
    right: 6px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.image-grid-item {
    position: relative;
}
@media (max-width: 600px) {
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }
    .image-grid-item img {
        height: 100px;
    }
    .search-tab {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}
