/* ─── Infiflex-compatible palette ─── */
:root {
    --navy: #0f1b2d;
    --navy-light: #1a2d4a;
    --blue: #2563eb;
    --blue-hover: #1d4ed8;
    --blue-light: #dbeafe;
    --blue-muted: #93c5fd;
    --orange: #f59e0b;
    --bg: #fafbfc;
    --white: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --green: #16a34a;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(15, 27, 45, 0.08), 0 1px 2px rgba(15, 27, 45, 0.04);
    --shadow-lg: 0 4px 16px rgba(15, 27, 45, 0.1), 0 2px 4px rgba(15, 27, 45, 0.06);
    --max-width: 800px;
    --content-start: 96px; /* logo width (~72px) + header gap (24px) */
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ─── Sign in button ─── */
.signin-btn {
    padding: 8px 20px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 60px;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.signin-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
}

.header-nav {
    position: fixed;
    top: 0;
    right: 0;
    padding: 20px 24px;
    z-index: 101;
}

.header-nav .signin-btn {
    color: var(--blue);
    background: transparent;
    border: 1px solid var(--border);
}

.header-nav .signin-btn:hover {
    background: var(--blue-light);
    border-color: var(--blue);
}

/* ─── Home nav ─── */
.home-nav {
    position: fixed;
    top: 0;
    right: 0;
    padding: 20px 24px;
    z-index: 10;
}

/* ═══════════════════════════════════
   HOME PAGE
   ═══════════════════════════════════ */
.home {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--navy);
}

.home-container {
    text-align: center;
    width: 100%;
    max-width: 640px;
    padding: 0 24px;
}

.home-hero {
    margin-bottom: 80px;
}

.logo {
    font-size: 4.5rem;
    font-weight: 800;
    letter-spacing: -3px;
    color: var(--white);
    margin-bottom: 12px;
    line-height: 1;
}

.tagline {
    font-size: 1.125rem;
    color: var(--blue-muted);
    margin-bottom: 40px;
    font-weight: 400;
}

/* Search box */
.search-box {
    display: flex;
    align-items: center;
    background: var(--white);
    border-radius: 60px;
    padding: 6px 6px 6px 20px;
    box-shadow: var(--shadow-lg);
    transition: box-shadow 0.2s;
}

.search-box:focus-within {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3), var(--shadow-lg);
}

.search-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

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

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--blue);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

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

.search-box button svg {
    width: 20px;
    height: 20px;
    color: var(--white);
}

/* Category pills */
.category-pills {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 24px;
}

.pill {
    cursor: pointer;
    display: inline-flex;
}

.pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pill span {
    padding: 8px 20px;
    border-radius: 60px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--blue-muted);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s;
    background: transparent;
}

.pill:hover span {
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--white);
}

.pill input:checked + span {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--white);
}

/* Home footer */
.home-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    text-align: center;
}

.powered-by {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    text-decoration: none;
    transition: opacity 0.2s;
}

.powered-by:hover {
    opacity: 0.8;
}

.home-footer .powered-by {
    color: rgba(255, 255, 255, 0.4);
}

.home-footer .powered-by:hover {
    color: rgba(255, 255, 255, 0.6);
}

.infiflex-logo {
    height: 18px;
    width: auto;
    vertical-align: middle;
}

/* ═══════════════════════════════════
   RESULTS PAGE
   ═══════════════════════════════════ */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 24px;
}

.header-logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -1.5px;
    color: var(--navy);
    text-decoration: none;
    white-space: nowrap;
}

.header-search {
    flex: 1;
    max-width: 600px;
}

.search-box-sm {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 60px;
    padding: 4px 4px 4px 16px;
    transition: all 0.2s;
}

.search-box-sm:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: var(--white);
}

.search-box-sm .search-icon {
    width: 16px;
    height: 16px;
}

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

.search-box-sm button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--blue);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

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

.search-box-sm button svg {
    width: 16px;
    height: 16px;
    color: var(--white);
}

/* Category bar */
.category-bar {
    border-top: 1px solid var(--border-light);
}

.category-bar-inner {
    display: flex;
    gap: 4px;
    padding: 0 24px 0 calc(24px + var(--content-start));
}

.cat-link {
    padding: 12px 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.cat-link:hover {
    color: var(--blue);
}

.cat-link.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
}

/* ─── Results content ─── */
.results-info {
    padding: 20px 24px 0 calc(24px + var(--content-start));
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    color: var(--border);
}

.results-layout {
    display: flex;
    gap: 40px;
    padding: 16px 24px 48px calc(24px + var(--content-start));
}

.results-list {
    flex: 1;
    max-width: var(--max-width);
    min-width: 0;
}

/* Result cards */
.result-card {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-light);
}

.result-card:first-child {
    padding-top: 12px;
}

.result-source {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.favicon {
    border-radius: 2px;
}

.result-source cite {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 6px;
}

.result-title a {
    color: var(--navy);
    text-decoration: none;
    transition: color 0.15s;
}

.result-title a:hover {
    color: var(--blue);
}

.result-title a:visited {
    color: var(--navy-light);
}

.result-snippet {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-meta {
    margin-top: 8px;
}

.engine-badge {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: capitalize;
}

/* ─── Sidebar / Infobox ─── */
.sidebar {
    width: 300px;
    flex-shrink: 0;
}

.infobox-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.infobox-card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 10px;
}

.infobox-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.infobox-links {
    list-style: none;
}

.infobox-links li {
    margin-bottom: 6px;
}

.infobox-links a {
    font-size: 0.8125rem;
    color: var(--blue);
    text-decoration: none;
}

.infobox-links a:hover {
    text-decoration: underline;
}

/* ─── Pagination ─── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.page-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--blue);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 60px;
    text-decoration: none;
    transition: all 0.15s;
}

.page-btn:hover {
    background: var(--blue-light);
    border-color: var(--blue);
}

.page-btn svg {
    width: 16px;
    height: 16px;
}

.page-current {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ─── Suggestions ─── */
.suggestions {
    padding: 0 24px 32px calc(24px + var(--content-start));
}

.suggestions-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 10px;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 8px 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 60px;
    text-decoration: none;
    transition: all 0.15s;
}

.chip:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: var(--blue-light);
}

/* ─── No Results ─── */
.no-results {
    text-align: center;
    padding: 120px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
}

.no-results-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.no-results h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.no-results p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ─── Footer ─── */
.results-footer {
    text-align: center;
    padding: 24px;
    border-top: 1px solid var(--border-light);
}

.results-footer .powered-by {
    color: var(--text-muted);
}

/* ─── HTMX Loading ─── */
.htmx-request #results-container {
    opacity: 0.5;
    transition: opacity 0.15s;
}

/* ═══════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════ */
@media (max-width: 768px) {
    .home-nav {
        padding: 12px 16px;
    }

    .home-nav .signin-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .logo {
        font-size: 3.5rem;
    }

    .tagline {
        font-size: 1rem;
        margin-bottom: 32px;
    }

    .category-pills {
        flex-wrap: wrap;
    }

    .results-layout {
        flex-direction: column;
        padding: 12px 16px 32px;
    }

    .sidebar {
        width: 100%;
    }

    .header-inner {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .header-logo {
        display: none;
    }

    .header-nav {
        display: none;
    }

    .header-search {
        max-width: 100%;
        width: 100%;
    }

    .category-bar-inner {
        padding: 0 16px;
        overflow-x: auto;
    }

    .results-info {
        padding: 12px 16px 0;
    }

    .suggestions {
        padding: 0 16px 24px;
    }
}
