/* =============================================================
 * search-autocomplete.css — Styles for the typeahead dropdown
 * beneath the main search input.
 *
 * Does NOT modify any existing CSS files.
 * ============================================================= */

/* ── Wrapper (injected by JS around .search-container) ────── */
.sac-wrap {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
}

/* When wrapped, the form no longer needs its own centering */
.sac-wrap .search-container {
    max-width: none;
    margin: 0;
}

/* ── Dropdown container ─────────────────────────────────────── */
.sac-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    margin-top: 4px;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55),
                0 0 0 1px rgba(255, 255, 255, 0.06);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.2s ease, opacity 0.15s ease, visibility 0s 0.2s;
}

.sac-dropdown.is-open {
    max-height: 460px;
    opacity: 1;
    visibility: visible;
    transition: max-height 0.25s ease, opacity 0.15s ease, visibility 0s;
    overflow-y: auto;
}

/* ── Individual suggestion item ─────────────────────────────── */
.sac-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background-color 0.1s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sac-item:last-child {
    border-bottom: none;
}

.sac-item:hover,
.sac-item.is-active {
    background: rgba(232, 93, 38, 0.12);
}

/* ── Thumbnail ──────────────────────────────────────────────── */
.sac-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
}

/* ── Body (title + badge) ───────────────────────────────────── */
.sac-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sac-item-title {
    color: #f0f0f0;
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sac-item-title strong {
    color: #E85D26;
    font-weight: 700;
}

.sac-item-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ── Source icons ────────────────────────────────────────────── */
.sac-icon {
    vertical-align: -2px;
    opacity: 0.5;
}

.sac-icon-pod {
    color: #E85D26;
}

.sac-icon-pdf {
    color: #e74c3c;
}

/* ── Scrollbar (subtle) ─────────────────────────────────────── */
.sac-dropdown::-webkit-scrollbar {
    width: 5px;
}

.sac-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.sac-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}

/* ── Light theme (if needed) ────────────────────────────────── */
@media (prefers-color-scheme: light) {
    .sac-dropdown {
        background: #fff;
        border-color: rgba(0, 0, 0, 0.1);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15),
                    0 0 0 1px rgba(0, 0, 0, 0.06);
    }

    .sac-item {
        border-bottom-color: rgba(0, 0, 0, 0.06);
    }

    .sac-item:hover,
    .sac-item.is-active {
        background: rgba(232, 93, 38, 0.08);
    }

    .sac-item-title {
        color: #222;
    }

    .sac-item-badge {
        color: rgba(0, 0, 0, 0.4);
    }

    .sac-thumb {
        background: rgba(0, 0, 0, 0.04);
    }
}

/* ── Mobile adjustments ─────────────────────────────────────── */
@media (max-width: 640px) {
    .sac-dropdown {
        border-radius: 8px;
        margin-top: 2px;
    }

    .sac-item {
        padding: 8px 12px;
        gap: 8px;
    }

    .sac-thumb {
        width: 34px;
        height: 34px;
        border-radius: 5px;
    }

    .sac-item-title {
        font-size: 13px;
    }
}
