/* ElbuzSearch - Live search dropdown styles */

/* ===== Overlay ===== */
.elbuz-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99998;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.elbuz-search-overlay-show {
    opacity: 1;
    pointer-events: auto;
}

/* ===== Dropdown container ===== */
.elbuz-search-dropdown {
    position: absolute;
    z-index: 99999;
    background: #fff;
    border: 1px solid #e2e5e9;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    display: none;
}

.elbuz-search-dropdown.elbuz-search-show {
    display: block;
    animation: elbuz-search-fade-in 0.2s ease-out;
}

@keyframes elbuz-search-fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Custom scrollbar */
.elbuz-search-dropdown::-webkit-scrollbar {
    width: 5px;
}

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

.elbuz-search-dropdown::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.elbuz-search-dropdown::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.elbuz-search-dropdown-inner {
    padding: 4px 0;
}

/* ===== Loading bar ===== */
.elbuz-search-dropdown.elbuz-search-loading::before {
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(90deg, #007bff 0%, #007bff 30%, transparent 30%);
    background-size: 200% 100%;
    animation: elbuz-search-loading 1.5s infinite;
}

@keyframes elbuz-search-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Generic item ===== */
.elbuz-search-item {
    display: block;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.elbuz-search-item:hover,
.elbuz-search-item.elbuz-search-active {
    background-color: #f5f7fa;
    text-decoration: none;
    color: #333;
}

/* ===== Section titles ===== */
.elbuz-search-section-title {
    padding: 8px 14px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #9ca3af;
    letter-spacing: 0.6px;
}

/* ===== Section dividers ===== */
.elbuz-search-suggestions,
.elbuz-search-products,
.elbuz-search-categories,
.elbuz-search-brands {
    border-bottom: 1px solid #f0f0f0;
}

/* ===== Scrollable products block ===== */
.elbuz-search-products {
    max-height: min(500px, 50vh);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.elbuz-search-products::-webkit-scrollbar {
    width: 5px;
}

.elbuz-search-products::-webkit-scrollbar-track {
    background: transparent;
}

.elbuz-search-products::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.elbuz-search-products::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* ===== Suggestion & Category & Brand tags ===== */
.elbuz-search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 14px 10px;
}

.elbuz-search-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #f0f2f5;
    border-radius: 16px;
    font-size: 13px;
    color: #555;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    white-space: nowrap;
    line-height: 1.4;
}

.elbuz-search-tag:hover,
.elbuz-search-tag.elbuz-search-active {
    background: #007bff;
    color: #fff;
    text-decoration: none;
}

/* ===== Product item ===== */
.elbuz-search-product {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    gap: 12px;
    border-left: 3px solid transparent;
    transition: background-color 0.15s, border-color 0.15s;
}

.elbuz-search-product:hover,
.elbuz-search-product.elbuz-search-active {
    background-color: #f5f7fa;
    border-left-color: #007bff;
}

.elbuz-search-product + .elbuz-search-product {
    border-top: 1px solid #f5f5f5;
}

/* Product image */
.elbuz-search-product-image {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    background: #f8f9fa;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.elbuz-search-product-image img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

/* Product info */
.elbuz-search-product-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.elbuz-search-product-name {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    color: #1a1a1a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Price */
.elbuz-search-product-price {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    margin-top: 3px;
}

.elbuz-search-product-price-old {
    text-decoration: line-through;
    color: #aaa;
    font-weight: 400;
    font-size: 12px;
    margin-right: 6px;
}

.elbuz-search-product-price-special {
    color: #e53935;
}
.elbuz-search-product-price-unavailable {
    color: #999;
    font-weight: 400;
}

/* Meta info (model, sku) */
.elbuz-search-product-meta {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Stock status */
.elbuz-search-product-stock {
    font-size: 11px;
    color: #16a34a;
    font-weight: 500;
    margin-top: 1px;
}
.elbuz-search-product-stock-out {
    color: #dc2626;
}

/* ===== All results button ===== */
.elbuz-search-all-results {
    display: block;
    padding: 10px 14px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #007bff;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.elbuz-search-all-results:hover {
    background-color: #eff6ff;
    color: #0056b3;
    text-decoration: none;
}

/* ===== Footer ===== */
.elbuz-search-footer {
    padding: 4px 14px 6px;
    text-align: right;
    font-size: 10px;
    color: #bbb;
}
.elbuz-search-footer a {
    color: #bbb;
    text-decoration: none;
}
.elbuz-search-footer a:hover {
    color: #999;
}

.elbuz-search-all-results.elbuz-loading {
    pointer-events: none;
    color: #999;
}

.elbuz-search-all-results.elbuz-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid #ccc;
    border-top-color: #007bff;
    border-radius: 50%;
    vertical-align: middle;
    animation: elbuz-spin 0.6s linear infinite;
}

@keyframes elbuz-spin {
    to { transform: rotate(360deg); }
}

/* ===== Empty state ===== */
.elbuz-search-empty {
    padding: 24px 14px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

.elbuz-search-empty-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto 8px;
    display: block;
    stroke: #ccc;
}

/* ===== Highlight matching text ===== */
.elbuz-search-highlight {
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
    font-style: normal;
}

.elbuz-search-highlight-0 { background: #fff3cd; }
.elbuz-search-highlight-1 { background: #cce5ff; }
.elbuz-search-highlight-2 { background: #d4edda; }
.elbuz-search-highlight-3 { background: #f5c6cb; }

.elbuz-search-tag .elbuz-search-highlight {
    background: rgba(0, 0, 0, 0.1);
}

.elbuz-search-tag:hover .elbuz-search-highlight,
.elbuz-search-tag.elbuz-search-active .elbuz-search-highlight {
    background: rgba(255, 255, 255, 0.25);
}

/* ===== Search history ===== */
.elbuz-search-history {
    border-bottom: 1px solid #f0f0f0;
}

.elbuz-search-history .elbuz-search-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.elbuz-search-history-clear {
    font-size: 11px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #9ca3af;
    cursor: pointer;
    text-decoration: none;
}

.elbuz-search-history-clear:hover {
    color: #e53935;
    text-decoration: none;
}

.elbuz-search-history-tag {
    position: relative;
    padding-right: 24px !important;
}

.elbuz-search-history-remove {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    line-height: 1;
    color: #bbb;
    cursor: pointer;
}

.elbuz-search-history-remove:hover {
    color: #e53935;
}

/* ===== Category tabs ===== */
.elbuz-search-category-tabs-wrap {
    padding: 6px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.elbuz-search-category-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow: hidden;
    gap: 4px;
    padding: 0;
}

.elbuz-search-category-tabs.elbuz-tabs-expanded {
    flex-wrap: wrap;
    overflow: visible;
}

.elbuz-search-category-tab {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    color: #555;
    text-decoration: none;
    cursor: pointer;
    background: #f5f7fa;
    border: 1px solid #e8ecf0;
    border-radius: 12px;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
    white-space: nowrap;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.elbuz-search-category-tab:hover {
    color: #333;
    background-color: #eef1f5;
    border-color: #d0d5dc;
    text-decoration: none;
}

.elbuz-search-category-tab-active {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.elbuz-search-category-tab-active:hover {
    background-color: #0069d9;
    border-color: #0062cc;
    color: #fff;
}

.elbuz-search-category-tab-hidden {
    display: none;
}

.elbuz-search-category-tab-more {
    color: #007bff;
    background: transparent;
    border: 1px dashed #b0cfee;
    font-weight: 600;
    max-width: none;
    overflow: visible;
    flex-shrink: 0;
}

.elbuz-search-category-tab-more:hover {
    background: #eff6ff;
    border-color: #007bff;
    color: #0056b3;
}

/* ===== Result count badge ===== */
.elbuz-search-count {
    font-weight: 400;
    color: #bbb;
    font-size: 10px;
}

/* ===== AJAX pagination loading ===== */
.elbuz-pjax-loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* ===== Mobile ===== */
@media (max-width: 767px) {
    .elbuz-search-dropdown {
        border-radius: 0 0 10px 10px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
        max-height: 70vh;
        overflow-y: auto;
    }

    .elbuz-search-products {
        max-height: none;
        overflow-y: visible;
    }

    .elbuz-search-product-name {
        -webkit-line-clamp: 3;
    }

    .elbuz-search-product {
        padding: 10px 14px;
    }
}
