/* AI Search Widget Styles */

.ai-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}

.ai-search-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.ai-search-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.ai-search-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.ai-search-view-toggle {
    display: flex;
    gap: 5px;
}

.view-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.view-btn:hover {
    background: #f0f0f0;
}

.view-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.view-btn i {
    margin-right: 5px;
}

.ai-search-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    color: #999;
    transition: color 0.2s;
    padding: 0;
    width: 32px;
    height: 32px;
}

.ai-search-close:hover {
    color: #333;
}

.ai-search-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.ai-search-filters {
    width: 250px;
    padding: 20px;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    background: #fafafa;
}

.ai-search-filters h4 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.filter-group {
    margin-bottom: 25px;
}

.filter-group h5 {
    margin: 0 0 10px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-option {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.filter-option input[type="checkbox"] {
    margin-right: 8px;
}

.filter-option span {
    color: #666;
}

.filter-option:hover span {
    color: #333;
}

.ai-search-results {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: grid;
    gap: 20px;
    align-content: start;
}

.ai-search-results[data-view="grid"] {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.ai-search-results[data-view="list"] {
    grid-template-columns: 1fr;
}

.ai-search-product {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: visible !important;
    transition: transform 0.2s, box-shadow 0.2s;
    background: white;
    min-height: 350px !important;
    height: auto !important;
}

.ai-search-product:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.ai-search-modal .product-link {
    display: block !important;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.ai-search-modal .product-image {
    position: relative;
    width: 100% !important;
    height: 220px !important;
    min-height: 220px !important;
    max-height: 220px !important;
    overflow: hidden;
    background: #f5f5f5;
    display: block !important;
}

.ai-search-modal .product-image img {
    width: 100% !important;
    height: 220px !important;
    max-height: 220px !important;
    object-fit: contain !important;
    padding: 10px;
}

.product-image .no-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 0.9rem;
}

.badge-sale,
.badge-out-of-stock {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-sale {
    background: #ff4444;
    color: white;
}

.badge-out-of-stock {
    background: #999;
    color: white;
}

.product-info {
    padding: 15px;
}

.product-name {
    font-size: 0.95rem;
    margin: 0 0 10px 0;
    line-height: 1.4;
    font-weight: 500;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.price-sale {
    color: #ff4444;
    font-weight: 600;
    font-size: 1.1rem;
}

.price-original {
    text-decoration: line-through;
    color: #999;
    font-size: 0.9rem;
}

.price {
    color: #333;
    font-weight: 600;
    font-size: 1.1rem;
}

.btn-add-to-cart,
.btn-out-of-stock {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-add-to-cart {
    background: #007bff;
    color: white;
}

.btn-add-to-cart:hover {
    background: #0056b3;
}

.btn-out-of-stock {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
}

/* List view styles */
.ai-search-results[data-view="list"] .ai-search-product {
    display: block;
}

.ai-search-results[data-view="list"] .product-link {
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

.ai-search-results[data-view="list"] .product-image {
    width: 200px;
    min-width: 200px;
    height: 200px;
    flex-shrink: 0;
}

.ai-search-results[data-view="list"] .product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.ai-search-results[data-view="list"] .product-name {
    font-size: 1.2rem;
}

.ai-search-results[data-view="list"] .btn-add-to-cart,
.ai-search-results[data-view="list"] .btn-out-of-stock {
    width: auto;
    padding: 12px 30px;
    align-self: flex-start;
}

/* Loading state */
.ai-search-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error state */
.ai-search-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #d9534f;
}

/* No results */
.ai-search-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.ai-search-no-results p {
    margin: 10px 0;
}

.suggestion-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.suggestion-link:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-search-modal-content {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .ai-search-body {
        flex-direction: column;
    }

    .ai-search-filters {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .ai-search-results[data-view="grid"] {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .ai-search-results[data-view="list"] .ai-search-product {
        flex-direction: column;
    }

    .ai-search-results[data-view="list"] .product-image {
        width: 100%;
        padding-top: 100%;
        height: auto;
    }
}

/* Scrollbar styling */
.ai-search-filters::-webkit-scrollbar,
.ai-search-results::-webkit-scrollbar {
    width: 8px;
}

.ai-search-filters::-webkit-scrollbar-track,
.ai-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ai-search-filters::-webkit-scrollbar-thumb,
.ai-search-results::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.ai-search-filters::-webkit-scrollbar-thumb:hover,
.ai-search-results::-webkit-scrollbar-thumb:hover {
    background: #999;
}
