/* AI Search Widget Styles - Modal Style */

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

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

.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;
}

/* Hide view toggle - always use grid view */
.ai-search-view-toggle {
    display: none;
}

.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;
    flex-shrink: 0;
    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;
}

.filter-count {
    margin-left: auto;
    color: #999;
    font-size: 0.8rem;
}

/* Active filter pills */
.filter-active-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    background: #e8f0fe;
    color: #1a73e8;
    cursor: pointer;
    transition: background 0.15s;
}

.filter-pill:hover {
    background: #d2e3fc;
}

.filter-pill-clear {
    background: #fce8e6;
    color: #d93025;
}

.filter-pill-clear:hover {
    background: #f8d7da;
}

/* Price range slider */
.filter-price-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.85rem;
    color: #333;
    font-weight: 500;
}

.filter-price-slider {
    position: relative;
    height: 30px;
    margin-bottom: 10px;
}

.filter-price-slider input.filter-range {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
    height: 30px;
}

.filter-price-slider input.filter-range::-webkit-slider-runnable-track {
    height: 4px;
    background: #ddd;
    border-radius: 2px;
}

.filter-price-slider input.filter-range:last-child::-webkit-slider-runnable-track {
    background: transparent;
}

.filter-price-slider input.filter-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    cursor: pointer;
    pointer-events: all;
    margin-top: -7px;
}

.filter-price-slider input.filter-range::-moz-range-track {
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    border: none;
}

.filter-price-slider input.filter-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    cursor: pointer;
    pointer-events: all;
}

.filter-price-go {
    width: 100%;
    padding: 6px 12px;
    border: 1px solid #007bff;
    background: #007bff;
    color: white;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
}

.filter-price-go:hover {
    background: #0056b3;
}

.ai-search-results {
    flex: 1;
    min-width: 0;
    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 {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        margin: 0;
    }

    .ai-search-modal-content {
        width: 100%;
        max-height: calc(100vh - 70px);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .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;
}
