﻿/* =====================================================
   SEARCH.CSS – BookStore Search Dropdown
   ===================================================== */

/* ── Dropdown container ─────────── */
#searchResult {
    position: fixed;
    top: 0;
    left: 0;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e8e2d9;
    border-top: 3px solid #ff6b35;
    box-shadow: 0 16px 48px rgba(30,26,20,0.18), 0 4px 16px rgba(0,0,0,0.08);
    min-width: 300px;
    max-width: 420px;
    width: 340px;
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    display: none;
    z-index: 99999;
    isolation: isolate;
    animation: fadeSearch .18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeSearch {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Scrollbar ──────────────────── */
#searchResult::-webkit-scrollbar {
    width: 4px;
}

#searchResult::-webkit-scrollbar-track {
    background: transparent;
}

#searchResult::-webkit-scrollbar-thumb {
    background: #e8e2d9;
    border-radius: 99px;
}

/* ── Mỗi item kết quả ───────────── */
.search-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    text-decoration: none;
    color: #1e1a14;
    border-bottom: 1px solid #f5f0e8;
    transition: background 0.15s ease;
    cursor: pointer;
}

    .search-item:last-child {
        border-bottom: none;
    }

    .search-item:hover {
        background: #f7f4ef;
    }

    /* ── Ảnh bìa sách ───────────────── */
    .search-item img {
        width: 42px !important;
        height: 58px !important;
        min-width: 42px;
        min-height: 58px;
        object-fit: cover;
        border-radius: 6px;
        border: 1px solid #e8e2d9;
        flex-shrink: 0;
        display: block;
        box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    }

/* ── Thông tin sách ─────────────── */
.search-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.search-item-title {
    font-size: 0.875rem;
    font-weight: 800;
    color: #1e1a14;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item-author {
    font-size: 0.75rem;
    color: #7a6f62;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Nút "Xem tất cả kết quả" ───── */
.search-item.view-all {
    justify-content: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 800;
    color: #ff6b35;
    background: #fff8f4;
    padding: 12px 16px;
    border-top: 1px solid #f5f0e8;
    border-bottom: none;
    border-radius: 0 0 16px 16px;
}

    .search-item.view-all:hover {
        background: #ffe9df;
        color: #e8521c;
    }

/* ── Trạng thái loading / no result / error ── */
.search-loading,
.search-no-result,
.search-error {
    padding: 20px 16px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #7a6f62;
}

    .search-loading i {
        color: #ff6b35;
        margin-right: 6px;
    }
