/* Enhanced Search Styles */

/* Search Container */
.search-section {
    position: relative !important;
}

/* Autocomplete Container */
.autocomplete-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
}

/* Autocomplete Items */
.autocomplete-item {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 12px;
}

.autocomplete-item:hover {
    background-color: #f8f9fa !important;
    transform: translateX(2px);
}

.autocomplete-item:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

/* Product Icon in Suggestions */
.autocomplete-item .product-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4a7c59, #6ba86f);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
}

/* Product Info in Suggestions */
.autocomplete-item .product-info {
    flex: 1;
    min-width: 0;
}

.autocomplete-item .product-name {
    font-weight: 500;
    margin-bottom: 2px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-item .product-meta {
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.autocomplete-item .product-price {
    font-weight: 600;
    color: #4a7c59;
}

/* Highlight Matched Text */
.autocomplete-item strong {
    background: linear-gradient(120deg, #fff3cd 0%, #fff3cd 100%);
    background-size: 100% 0.2em;
    background-repeat: no-repeat;
    background-position: 0 88%;
    font-weight: 600;
    color: #333;
}

/* View All Results Button */
.autocomplete-item.view-all {
    background: #f8f9fa !important;
    font-weight: 500;
    color: #4a7c59 !important;
    text-align: center;
    border-top: 1px solid #e0e0e0;
    justify-content: center;
}

.autocomplete-item.view-all:hover {
    background: #e9ecef !important;
    color: #2e5d3e !important;
}

/* Search Input Focus State */
.main-search-bar:focus {
    outline: none;
    border-color: #4a7c59;
    box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.1);
}

/* Mobile Responsive Autocomplete */
@media (max-width: 768px) {
    .autocomplete-container {
        max-height: 280px;
        border-radius: 0 0 8px 8px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }
    
    .autocomplete-item {
        padding: 12px 14px;
        font-size: 13px;
    }
    
    .autocomplete-item .product-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .autocomplete-item .product-meta {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .autocomplete-container {
        max-height: 250px;
        left: -5px;
        right: -5px;
    }
    
    .autocomplete-item {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .autocomplete-item .product-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
        border-radius: 6px;
    }
    
    .autocomplete-item .product-name {
        font-size: 13px;
    }
    
    .autocomplete-item .product-meta {
        font-size: 10px;
    }
}

/* Loading State */
.autocomplete-loading {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.autocomplete-loading::before {
    content: "🔍";
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* No Results State */
.autocomplete-no-results {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.autocomplete-no-results::before {
    content: "😔";
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
}

/* Search History */
.search-history {
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.search-history-title {
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-history-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-history-item:hover {
    background: #e9ecef;
}

.search-history-item::before {
    content: "🕒";
    font-size: 12px;
}

/* Scrollbar Styling */
.autocomplete-container::-webkit-scrollbar {
    width: 6px;
}

.autocomplete-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.autocomplete-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.autocomplete-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animation for showing autocomplete */
.autocomplete-container.show {
    animation: slideDown 0.2s ease-out;
}

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

/* Search Results Page Styles */
.search-results-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-radius: 12px;
}

.search-results-title {
    color: #333;
    margin-bottom: 0.5rem;
}

.search-results-count {
    color: #666;
    font-size: 14px;
}

.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
}

.no-results h3 {
    margin-bottom: 1rem;
    color: #333;
}

.no-results p {
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 10000;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideInRight 0.3s ease-out;
}

.toast.error {
    background: #dc3545;
}

.toast.warning {
    background: #ffc107;
    color: #333;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile Toast */
@media (max-width: 480px) {
    .toast {
        left: 10px;
        right: 10px;
        top: 10px;
    }
}