/**
 * Search Autocomplete Styles
 * Professional dropdown for search suggestions
 */

/* Suggestions Container */
.search-suggestions {
    position: absolute;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    width: 100%;
    max-height: 500px;
    overflow-y: auto;
    z-index: 1050;
    top: calc(100% + 8px);
    left: 0;
    display: none;
    animation: slideDown 0.2s ease-out;
}

.dark .search-suggestions {
    background: #1f2937;
    border-color: #374151;
}

.search-suggestions.show {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section Headers */
.suggestion-section {
    border-bottom: 1px solid #f3f4f6;
}

.dark .suggestion-section {
    border-bottom-color: #374151;
}

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

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

.dark .suggestion-header {
    background: #111827;
    color: #9ca3af;
}

.suggestion-header svg {
    color: #9ca3af;
}

/* Suggestion Items Container */
.suggestion-items {
    padding: 4px 0;
}

/* Individual Suggestion Item */
.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: #1f2937;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.dark .suggestion-item {
    color: #f3f4f6;
}

.suggestion-item:hover {
    background: #f9fafb;
    border-left-color: var(--bs-orange-500);
}

.dark .suggestion-item:hover {
    background: #374151;
    border-left-color: #fb923c;
}

/* Category Suggestions */
.suggestion-category {
    gap: 10px;
}

.suggestion-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 8px;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.dark .suggestion-icon {
    background: #4b5563;
}

.suggestion-item:hover .suggestion-icon {
    background: #fef3c7;
    color: var(--bs-orange-500);
}

.dark .suggestion-item:hover .suggestion-icon {
    background: #92400e;
    color: #fb923c;
}

.suggestion-icon svg {
    width: 20px;
    height: 20px;
    color: #6b7280;
    stroke: currentColor;
    fill: none;
}

.suggestion-item:hover .suggestion-icon svg {
    color: var(--bs-orange-500);
    stroke: var(--bs-orange-500);
}

.suggestion-arrow {
    margin-left: auto;
    color: #9ca3af;
    flex-shrink: 0;
}

/* Product Suggestions */
.suggestion-product {
    gap: 12px;
}

.suggestion-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: #f9fafb;
}

.dark .suggestion-image {
    border-color: #4b5563;
    background: #374151;
}

.suggestion-details {
    flex: 1;
    min-width: 0;
}

.suggestion-name {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dark .suggestion-name {
    color: #f3f4f6;
}

.suggestion-name mark {
    background: #fef3c7;
    color: #92400e;
    padding: 0 2px;
    border-radius: 2px;
}

.dark .suggestion-name mark {
    background: #92400e;
    color: #fef3c7;
}

.suggestion-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.suggestion-code {
    font-family: 'Courier New', monospace;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.dark .suggestion-code {
    background: #4b5563;
    color: #d1d5db;
}

.suggestion-brand {
    color: #9ca3af;
}

.suggestion-price-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.suggestion-price {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
}

.dark .suggestion-price {
    color: #f3f4f6;
}

.suggestion-price-original {
    font-size: 13px;
    color: #9ca3af;
    text-decoration: line-through;
}

.suggestion-price-offer {
    color: var(--bs-orange-500) !important;
    font-size: 16px;
}

.suggestion-badge-offer {
    font-size: 10px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--bs-orange-500), #ea580c);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Footer */
.suggestion-footer {
    border-top: 1px solid #e5e7eb;
    padding: 12px 16px;
    background: #f9fafb;
}

.dark .suggestion-footer {
    border-top-color: #374151;
    background: #111827;
}

.suggestion-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--bs-orange-500);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.dark .suggestion-view-all {
    color: #fb923c;
}

.suggestion-view-all:hover {
    background: white;
    color: var(--bs-orange-600);
}

.dark .suggestion-view-all:hover {
    background: #374151;
    color: #fb923c;
}

.suggestion-view-all strong {
    font-weight: 600;
}

.suggestion-view-all svg {
    transition: transform 0.15s ease;
}

.suggestion-view-all:hover svg {
    transform: translateX(2px);
}

/* No Results */
.suggestion-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #6b7280;
}

.dark .suggestion-no-results {
    color: #9ca3af;
}

.suggestion-no-results svg {
    opacity: 0.5;
}

.suggestion-no-results p {
    font-size: 14px;
}

.suggestion-no-results strong {
    color: #1f2937;
    font-weight: 600;
}

.dark .suggestion-no-results strong {
    color: #f3f4f6;
}

/* Error State */
.suggestion-error {
    padding: 32px 20px;
    text-align: center;
    color: #6b7280;
}

.suggestion-error p {
    font-size: 13px;
}

/* Scrollbar Styling */
.search-suggestions::-webkit-scrollbar {
    width: 6px;
}

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

.dark .search-suggestions::-webkit-scrollbar-track {
    background: #1f2937;
}

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

.dark .search-suggestions::-webkit-scrollbar-thumb {
    background: #4b5563;
}

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

.dark .search-suggestions::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Mobile Suggestions - Specific adjustments for mobile sidebar */
.search-suggestions-mobile {
    max-height: 60vh;
    z-index: 10001;
}

.search-suggestions-mobile .suggestion-item {
    min-height: 50px;
    padding: 12px 16px;
}

.search-suggestions-mobile .suggestion-image {
    width: 45px;
    height: 45px;
}

.search-suggestions-mobile .suggestion-icon {
    width: 40px;
    height: 40px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .search-suggestions {
        max-height: 400px;
        border-radius: 10px;
    }

    .suggestion-item {
        padding: 10px 14px;
    }

    .suggestion-image {
        width: 45px;
        height: 45px;
    }

    .suggestion-name {
        font-size: 13px;
    }

    .suggestion-price {
        font-size: 14px;
    }

    .suggestion-price-offer {
        font-size: 15px;
    }

    .suggestion-price-original {
        font-size: 12px;
    }

    .suggestion-badge-offer {
        font-size: 9px;
        padding: 2px 5px;
    }
}

@media (max-width: 480px) {
    .search-suggestions {
        max-height: 350px;
    }

    .suggestion-header {
        padding: 10px 12px;
        font-size: 11px;
    }

    .suggestion-item {
        padding: 10px 12px;
        gap: 10px;
    }

    .suggestion-image {
        width: 40px;
        height: 40px;
    }

    .suggestion-name {
        font-size: 12px;
    }

    .suggestion-meta {
        font-size: 11px;
        gap: 6px;
    }

    .suggestion-price {
        font-size: 13px;
    }

    .suggestion-price-offer {
        font-size: 14px;
    }

    .suggestion-price-original {
        font-size: 11px;
    }

    .suggestion-price-wrapper {
        gap: 4px;
    }
}

/* ================================
   SEARCH HISTORY STYLES
   ================================ */

/* History Item */
.suggestion-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}

.suggestion-history-item:hover {
    background: #f9fafb;
    border-left-color: var(--bs-orange-500);
}

.dark .suggestion-history-item:hover {
    background: #374151;
    border-left-color: #fb923c;
}

/* History Icon */
.history-icon {
    width: 18px;
    height: 18px;
    color: #9ca3af;
    flex-shrink: 0;
}

.dark .history-icon {
    color: #6b7280;
}

.suggestion-history-item:hover .history-icon {
    color: var(--bs-orange-500);
}

.dark .suggestion-history-item:hover .history-icon {
    color: #fb923c;
}

/* History Query Text */
.history-query {
    flex: 1;
    font-size: 14px;
    color: #1f2937;
    cursor: pointer;
}

.dark .history-query {
    color: #f3f4f6;
}

/* Remove Button */
.history-remove {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    opacity: 0;
}

.suggestion-history-item:hover .history-remove {
    opacity: 1;
}

.history-remove:hover {
    background: #fee2e2;
    color: #dc2626;
}

.dark .history-remove:hover {
    background: #7f1d1d;
    color: #fca5a5;
}

/* Clear History Button */
.suggestion-clear-history {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
    cursor: pointer;
}

.suggestion-clear-history:hover {
    background: #fee2e2;
    color: #dc2626;
}

.dark .suggestion-clear-history {
    color: #9ca3af;
}

.dark .suggestion-clear-history:hover {
    background: #7f1d1d;
    color: #fca5a5;
}

.suggestion-clear-history svg {
    transition: transform 0.15s ease;
}

.suggestion-clear-history:hover svg {
    transform: scale(1.1);
}

/* Loading State (optional) */
@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.suggestion-loading {
    height: 60px;
    margin: 8px 16px;
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

.dark .suggestion-loading {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
}

/* Skeleton Components */
.skeleton-line {
    background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 6px;
}

.dark .skeleton-line {
    background: linear-gradient(90deg, #374151 0%, #4b5563 50%, #374151 100%);
}

.skeleton-image-suggestion {
    width: 50px;
    height: 50px;
    background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
    flex-shrink: 0;
}

.dark .skeleton-image-suggestion {
    background: linear-gradient(90deg, #374151 0%, #4b5563 50%, #374151 100%);
}

.suggestion-product-skeleton {
    pointer-events: none;
    cursor: default;
}

.suggestion-product-skeleton:hover {
    background: transparent;
    border-left-color: transparent;
}
