/**
 * Search Autocomplete Dropdown Styles
 * Design moderne avec séparation Produits/Vendeurs
 */

/* === Container principal === */
.search-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.search-autocomplete-dropdown::-webkit-scrollbar {
    width: 6px;
}

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

.search-autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.search-autocomplete-dropdown.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* === Section headers === */
.autocomplete-section {
    border-bottom: 1px solid #f1f5f9;
}

.autocomplete-section:last-of-type {
    border-bottom: none;
}

.autocomplete-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem 0.5rem;
    background: linear-gradient(to bottom, #f8fafc, #ffffff);
    position: sticky;
    top: 0;
    z-index: 1;
}

.autocomplete-section-icon {
    font-size: 1rem;
}

.autocomplete-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex: 1;
}

.autocomplete-section-count {
    font-size: 0.6875rem;
    font-weight: 500;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
}

/* === Items === */
.autocomplete-section-items {
    padding: 0.25rem 0.5rem 0.5rem;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    transition: all 0.15s ease;
    cursor: pointer;
}

.autocomplete-item:hover,
.autocomplete-item.is-active {
    background: #f1f5f9;
}

.autocomplete-item.is-active {
    background: linear-gradient(135deg, rgba(var(--primary-rgb, 21, 101, 192), 0.08), rgba(var(--secondary-rgb, 79, 195, 247), 0.08));
}

/* === Item image === */
.autocomplete-item-image {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.autocomplete-item-image--round {
    border-radius: 50%;
}

.autocomplete-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.autocomplete-item-placeholder {
    font-size: 1.5rem;
    opacity: 0.6;
}

/* === Item content === */
.autocomplete-item-content {
    flex: 1;
    min-width: 0;
}

.autocomplete-item-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.autocomplete-item-creator {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #64748b;
}

.autocomplete-creator-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
}

.autocomplete-item-description {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Item price === */
.autocomplete-item-price {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color, #1565c0);
    white-space: nowrap;
    flex-shrink: 0;
}

/* === Item meta === */
.autocomplete-item-meta {
    flex-shrink: 0;
}

.autocomplete-product-count {
    font-size: 0.6875rem;
    font-weight: 500;
    color: #64748b;
    background: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
}

/* === Footer === */
.autocomplete-footer {
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.autocomplete-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: linear-gradient(135deg, var(--primary-color, #1565c0), var(--secondary-color, #4fc3f7));
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.autocomplete-view-all:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.3);
}

.autocomplete-view-all svg {
    flex-shrink: 0;
}

/* === Dark mode support === */
[data-theme="dark"] .search-autocomplete-dropdown,
.dark-mode .search-autocomplete-dropdown {
    background: #1e293b;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .autocomplete-section,
.dark-mode .autocomplete-section {
    border-color: #334155;
}

[data-theme="dark"] .autocomplete-section-header,
.dark-mode .autocomplete-section-header {
    background: linear-gradient(to bottom, #1e293b, #1e293b);
}

[data-theme="dark"] .autocomplete-section-title,
.dark-mode .autocomplete-section-title {
    color: #94a3b8;
}

[data-theme="dark"] .autocomplete-section-count,
.dark-mode .autocomplete-section-count {
    background: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .autocomplete-item:hover,
[data-theme="dark"] .autocomplete-item.is-active,
.dark-mode .autocomplete-item:hover,
.dark-mode .autocomplete-item.is-active {
    background: #334155;
}

[data-theme="dark"] .autocomplete-item-image,
.dark-mode .autocomplete-item-image {
    background: #334155;
}

[data-theme="dark"] .autocomplete-item-name,
.dark-mode .autocomplete-item-name {
    color: #f1f5f9;
}

[data-theme="dark"] .autocomplete-item-creator,
[data-theme="dark"] .autocomplete-item-description,
.dark-mode .autocomplete-item-creator,
.dark-mode .autocomplete-item-description {
    color: #94a3b8;
}

[data-theme="dark"] .autocomplete-item-price,
.dark-mode .autocomplete-item-price {
    color: #38bdf8;
}

[data-theme="dark"] .autocomplete-product-count,
.dark-mode .autocomplete-product-count {
    background: #475569;
    color: #cbd5e1;
}

[data-theme="dark"] .autocomplete-footer,
.dark-mode .autocomplete-footer {
    background: #0f172a;
    border-color: #334155;
}

/* === Responsive === */
@media (max-width: 768px) {
    .search-autocomplete-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 60vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .search-autocomplete-dropdown.is-open {
        transform: translateY(0);
    }

    .autocomplete-item-image {
        width: 40px;
        height: 40px;
    }

    .autocomplete-item-name {
        font-size: 0.875rem;
    }

    .autocomplete-item-price {
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .autocomplete-section-header {
        padding: 0.625rem 0.75rem 0.375rem;
    }

    .autocomplete-section-items {
        padding: 0.25rem 0.375rem 0.375rem;
    }

    .autocomplete-item {
        padding: 0.5rem 0.625rem;
        gap: 0.625rem;
    }

    .autocomplete-item-image {
        width: 36px;
        height: 36px;
    }

    .autocomplete-footer {
        padding: 0.625rem 0.75rem;
    }
}
