/**
 * Search Autocomplete Dropdown Styles
 * Clean, modern design with proper RTL support
 */

/* Dropdown Container */
.search-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 9999 !important;
    max-height: 450px;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    border: 1px solid #e5e7eb;
}

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

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

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

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

/* Ensure search bar doesn't clip dropdown */
.search-bar {
    overflow: visible !important;
}

/* Section Styling */
.autocomplete-section {
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

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

.autocomplete-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f9fafb;
}

.autocomplete-section-title i {
    font-size: 10px;
    color: #9ca3af;
}

/* Item Styling */
.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none !important;
    color: #1f2937 !important;
    background: #ffffff;
}

.autocomplete-item:hover {
    background: #f3f4f6;
}

/* Image container */
.autocomplete-item-image {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
}

.autocomplete-item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

/* Icon container (for categories/brands without images) */
.autocomplete-item-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.autocomplete-item-icon i {
    font-size: 16px;
    color: #6b7280;
}

/* Content */
.autocomplete-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.autocomplete-item-name {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.autocomplete-item-name mark {
    background: #fef08a;
    color: #1f2937;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

.autocomplete-item-type {
    font-size: 12px;
    color: #9ca3af;
}

/* Price styling */
.autocomplete-item-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.autocomplete-item-price .current-price {
    font-size: 14px;
    font-weight: 600;
    color: #059669;
}

.autocomplete-item-price .original-price {
    font-size: 12px;
    color: #9ca3af;
    text-decoration: line-through;
}

/* Arrow */
.autocomplete-item-arrow {
    font-size: 12px;
    color: #d1d5db;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.autocomplete-item:hover .autocomplete-item-arrow {
    color: #6b7280;
}

/* View All Link */
.autocomplete-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    background: #f9fafb;
    color: #374151 !important;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none !important;
    border-top: 1px solid #e5e7eb;
    transition: background 0.15s ease;
}

.autocomplete-view-all:hover {
    background: #f3f4f6;
    color: #1f2937 !important;
}

.autocomplete-view-all i {
    font-size: 12px;
    color: #6b7280;
}

/* No Results */
.autocomplete-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
    color: #6b7280;
}

.autocomplete-no-results i {
    font-size: 32px;
    color: #d1d5db;
    margin-bottom: 12px;
}

.autocomplete-no-results p {
    font-size: 14px;
    margin: 0;
    color: #6b7280;
}

/* Results Wrapper */
.autocomplete-results-wrapper {
    position: relative;
}


/* Loading State */
.autocomplete-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    color: #6b7280;
    font-size: 13px;
}

.autocomplete-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: autocomplete-spin 0.7s linear infinite;
}

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


/* RTL Support */
[dir="rtl"] .autocomplete-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .autocomplete-section-title {
    flex-direction: row-reverse;
}

[dir="rtl"] .autocomplete-view-all {
    flex-direction: row-reverse;
}

[dir="rtl"] .autocomplete-item-price {
    flex-direction: row-reverse;
}

[dir="rtl"] .autocomplete-item-content {
    text-align: right;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .search-autocomplete-dropdown {
        position: fixed;
        top: 70px;
        left: 8px;
        right: 8px;
        max-height: 60vh;
        border-radius: 12px;
    }

    .autocomplete-item {
        padding: 12px 14px;
    }

    .autocomplete-item-image,
    .autocomplete-item-icon {
        width: 44px;
        height: 44px;
    }
}

