:root {
    --bg: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #666;
    --border: #e5e5e5;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --danger: #dc2626;
    --warn: #f59e0b;
    --surface: #f8f9fa;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --radius: 8px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111827;
        --text: #f1f5f9;
        --text-secondary: #94a3b8;
        --border: #1e293b;
        --accent: #3b82f6;
        --accent-hover: #60a5fa;
        --surface: #1e293b;
        --shadow: 0 1px 3px rgba(0,0,0,0.2);
    }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 17px; -webkit-font-smoothing: antialiased; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    max-width: 720px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 4rem;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* Header */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.site-logo { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.site-logo span { color: var(--accent); }
.site-nav { display: flex; gap: 1.5rem; }
.site-nav a { color: var(--text-secondary); font-size: 0.9rem; }
.site-nav a:hover { color: var(--text); text-decoration: none; }

/* Hero */
.hero { padding: 2rem 0 2.5rem; text-align: center; }
.hero h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.75rem; letter-spacing: -0.02em; }
.hero p { color: var(--text-secondary); font-size: 1.05rem; margin-bottom: 1.5rem; max-width: 520px; margin-left: auto; margin-right: auto; }

.search-box {
    display: flex;
    max-width: 480px;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.search-box input {
    flex: 1;
    border: none;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    background: transparent;
    color: var(--text);
    outline: none;
}

.search-box button {
    border: none;
    background: var(--accent);
    color: #fff;
    padding: 0.85rem 1.4rem;
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 600;
}

.search-box button:hover { background: var(--accent-hover); }

/* Category Grid */
.section-title { font-size: 1.1rem; font-weight: 600; margin: 2rem 0 1rem; }

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

.category-card {
    display: block;
    padding: 1.25rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.category-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.category-card .name { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.category-card .count { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.25rem; }

/* Pain Point Page */
.breadcrumb { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--text-secondary); }

.product-header { margin-bottom: 2rem; }
.product-header h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.product-header .summary { font-size: 1.05rem; color: var(--text-secondary); line-height: 1.7; }
.product-header .stats { display: flex; gap: 1.5rem; margin-top: 1rem; font-size: 0.85rem; color: var(--text-secondary); }
.product-header .stats strong { color: var(--text); }

/* Pain Point Cards */
.pain-point {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    background: var(--surface);
}

.pain-point .pp-header { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.75rem; }
.pain-point .pp-number { font-size: 1.5rem; font-weight: 800; color: var(--accent); line-height: 1; min-width: 2rem; }
.pain-point .pp-title { font-size: 1.1rem; font-weight: 600; }
.pain-point .pp-badges { display: flex; gap: 0.5rem; margin-top: 0.25rem; }
.pain-point .badge { font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 100px; font-weight: 600; }

.badge-severe { background: #fef2f2; color: var(--danger); }
.badge-frequent { background: #fffbeb; color: var(--warn); }
.badge-systemic { background: #eff6ff; color: var(--accent); }

@media (prefers-color-scheme: dark) {
    .badge-severe { background: #450a0a; }
    .badge-frequent { background: #451a03; }
    .badge-systemic { background: #172554; }
}

.pain-point .pp-body { font-size: 0.95rem; line-height: 1.7; }
.pain-point .pp-quote {
    border-left: 3px solid var(--accent);
    padding: 0.5rem 1rem;
    margin: 0.75rem 0;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.pain-point .pp-source { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.75rem; }
.pain-point .pp-source a { color: var(--text-secondary); border-bottom: 1px dotted var(--border); }

/* Source tag */
.source-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    margin-right: 0.3rem;
}
.source-tag.l1 { border-color: #22c55e; color: #16a34a; }
.source-tag.l2 { border-color: var(--accent); color: var(--accent); }

/* Alternatives */
.alternative-list { list-style: none; padding: 0; }
.alternative-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.alternative-list li:last-child { border-bottom: none; }
.alternative-list .alt-name { font-weight: 600; }
.alternative-list .alt-price { color: var(--text-secondary); font-size: 0.9rem; }
.alternative-list .alt-link { font-size: 0.85rem; }

/* CTA Section */
.cta {
    text-align: center;
    padding: 2rem;
    margin: 2rem 0;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.cta h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.cta p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1rem; }
.cta input {
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    width: 280px;
    max-width: 100%;
    background: var(--bg);
    color: var(--text);
}
.cta button {
    padding: 0.7rem 1.4rem;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    margin-left: 0.5rem;
}
.cta button:hover { background: var(--accent-hover); }

/* Footer */
.site-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Disclaimer */
.disclaimer {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 2rem 0;
    line-height: 1.6;
}

/* Methodology link banner */
.method-banner {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--accent);
    background: var(--surface);
    border-radius: 0 var(--radius) var(--radius) 0;
}

/* Utility */
.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.tag { font-size: 0.75rem; padding: 0.15rem 0.55rem; border-radius: 100px; border: 1px solid var(--border); color: var(--text-secondary); }

/* Responsive */
@media (max-width: 600px) {
    body { padding: 1rem 0.85rem 2rem; font-size: 16px; }
    .hero h1 { font-size: 1.45rem; }
    .category-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .site-header { flex-direction: column; gap: 0.5rem; }
    .product-header h1 { font-size: 1.4rem; }
    .cta input { width: 100%; margin-bottom: 0.5rem; }
    .cta button { width: 100%; margin-left: 0; }
    .search-overlay-panel { width: 100%; max-width: 100%; border-radius: var(--radius) var(--radius) 0 0; }
}

/* ========================================================================
   Search Overlay
   ======================================================================== */
#search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}
#search-overlay.open { display: block; }

.search-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    animation: fadeIn 0.15s ease;
}

.search-overlay-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 680px;
    max-width: 95vw;
    max-height: 85vh;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    animation: slideUp 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, -45%); } to { opacity: 1; transform: translate(-50%, -50%); } }

.search-overlay-close {
    position: sticky;
    top: 0;
    float: right;
    z-index: 10;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    line-height: 1;
}
.search-overlay-close:hover { color: var(--text); }

.search-overlay-content { padding: 1.5rem 2rem 2rem; }

/* Loading state */
.search-loading { text-align: center; padding: 2rem 0; }
.search-loading h2 { font-size: 1.2rem; margin-bottom: 1.5rem; }
.search-loading h2 span { color: var(--accent); }

.search-progress-track {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 1.25rem;
    max-width: 360px;
    overflow: hidden;
}
.search-progress-bar {
    height: 100%;
    width: 5%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.search-status-text { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0.5rem; }
.search-estimate { color: var(--text-secondary); font-size: 0.8rem; opacity: 0.7; }

/* Result header */
.search-result-header { margin-bottom: 1.5rem; }
.search-result-header h2 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.search-result-header h2 span { color: var(--accent); }
.search-summary { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.55; }
.search-meta-row { display: flex; gap: 1.5rem; margin-top: 0.75rem; font-size: 0.8rem; color: var(--text-secondary); flex-wrap: wrap; }
.search-meta { font-size: 0.8rem; color: var(--text-secondary); }

/* Pain point cards in results */
.search-pp-list { display: flex; flex-direction: column; gap: 0.85rem; margin-bottom: 1.5rem; }
.search-pp {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    background: var(--bg);
}
.search-pp-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.search-pp-rank {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent);
    min-width: 1.8em;
}
.search-pp-title { font-weight: 600; font-size: 0.95rem; flex: 1; }
.search-pp-severity {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
}
.sev-high { background: #fde8e8; color: #c53030; }
.sev-medium { background: #fef3c7; color: #b7791f; }
.sev-low { background: #e6fffa; color: #2c7a7b; }

.search-pp-summary { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 0.4rem; }
.search-pp-sources {
    margin: 0.4rem 0 0;
    padding-left: 1.2rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.search-pp-sources li { margin-bottom: 0.2rem; }

/* Alternatives */
.search-alternatives {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    margin-bottom: 1.5rem;
}
.search-alternatives h3 { font-size: 0.9rem; margin-bottom: 0.5rem; }
.search-alternatives ul { margin: 0; padding-left: 1.2rem; font-size: 0.88rem; }
.search-alternatives li { margin-bottom: 0.25rem; }

/* Disclaimer & footer */
.search-disclaimer {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.65rem 0.85rem;
    border-left: 3px solid var(--accent);
    background: var(--bg);
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 1.25rem;
}
.search-result-footer {
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-top: 0.5rem;
}
.search-result-footer p { margin-bottom: 0.35rem; }

/* States */
.search-error, .search-no-results, .search-redirect { text-align: center; padding: 1.5rem 0; }
.search-error h2, .search-no-results h2, .search-redirect h2 { font-size: 1.15rem; margin-bottom: 0.75rem; }
.search-error p, .search-no-results p, .search-redirect p { color: var(--text-secondary); margin-bottom: 0.5rem; }
.search-no-results ul { text-align: left; max-width: 400px; margin: 0.75rem auto; color: var(--text-secondary); font-size: 0.88rem; }
.search-no-pp { color: var(--text-secondary); font-size: 0.9rem; }

/* Redirect animation */
.search-redirect { animation: fadeIn 0.3s ease; }

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .search-overlay-backdrop { background: rgba(0, 0, 0, 0.7); }
    .sev-high { background: rgba(197, 48, 48, 0.18); color: #fc8181; }
    .sev-medium { background: rgba(183, 121, 31, 0.18); color: #f6ad55; }
    .sev-low { background: rgba(44, 122, 123, 0.18); color: #4fd1c5; }
}
