/* ==========================================
   AJAX SEARCH DROPDOWN STYLES
   ========================================== */

/* Search results dropdown container */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 500px;
    overflow-y: auto;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    margin-top: 8px;
}

.search-results-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Search sections */
.search-section {
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

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

.search-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #6b7280;
    padding: 8px 16px;
    letter-spacing: 0.5px;
}

/* Loading state */
.search-loading {
    padding: 20px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

/* No results */
.search-no-results {
    padding: 20px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

/* Category items */
.search-category-list {
    display: flex;
    flex-direction: column;
}

.search-category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: #1f2937;
    text-decoration: none;
    transition: background-color 0.2s ease;
    font-size: 14px;
}

.search-category-item:hover {
    background-color: #f3f4f6;
}

.search-category-item svg {
    width: 18px;
    height: 18px;
    color: #6b7280;
    flex-shrink: 0;
}

/* Product items */
.search-product-list {
    display: flex;
    flex-direction: column;
}

.search-product-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.search-product-item:hover {
    background-color: #f3f4f6;
}

.search-product-image {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-product-info {
    flex: 1;
    min-width: 0;
}

.search-product-name {
    font-size: 14px;
    color: #1f2937;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.search-product-price {
    font-size: 14px;
    color: #ef4444;
    font-weight: 600;
}

/* View all results */
.search-view-all {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.search-view-all-link {
    display: inline-block;
    color: #3b82f6;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.search-view-all-link:hover {
    background-color: #eff6ff;
}

/* Mobile search overlay positioning */
.mobile-search-overlay .search-results-dropdown {
    position: static;
    margin-top: 16px;
    max-height: calc(100vh - 200px);
    box-shadow: none;
    border: 1px solid #e5e7eb;
}

/* Desktop search bar relative positioning */
.search-bar {
    position: relative;
}

.search-bar .search-form {
    display: flex;
    width: 100%;
}

/* Scrollbar styling for search results */
.search-results-dropdown::-webkit-scrollbar {
    width: 8px;
}

.search-results-dropdown::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 8px;
}

.search-results-dropdown::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 8px;
}

.search-results-dropdown::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-results-dropdown {
        max-height: 400px;
    }

    .search-product-image {
        width: 40px;
        height: 40px;
    }

    .search-product-name {
        font-size: 13px;
    }

    .search-product-price {
        font-size: 13px;
    }
}

/* Animation for items appearing */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-results-dropdown.active .search-product-item,
.search-results-dropdown.active .search-category-item {
    animation: slideIn 0.2s ease forwards;
}
