/**
 * AI Smart Search - Frontend Styles
 * Using theme colors instead of blue
 */

/* Container */
.ai-search-container,
.ai-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.ai-search-react-wrapper {
    width: 100%;
}

/* Input Wrapper */
.ai-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* Search Input */
.ai-search-input {
    width: 100%;
    padding: 12px 48px 12px 16px;
    font-size: 16px;
    line-height: 1.5;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
    background: #fff;
    color: #333;
}

.ai-search-input:focus {
    border-color: var(--wc-primary-color, #96588a);
    box-shadow: 0 0 0 3px rgba(150, 88, 138, 0.1);
}

.ai-search-input::placeholder {
    color: #999;
}

/* Search Icon */
.ai-search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading Spinner */
.ai-search-loading {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-spinner {
    animation: spin 1s linear infinite;
    color: var(--wc-primary-color, #96588a);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Results Dropdown */
.ai-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 9999;
}

.ai-search-dropdown::-webkit-scrollbar {
    width: 8px;
}

.ai-search-dropdown::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
}

.ai-search-dropdown::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.ai-search-dropdown::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Result Item */
.ai-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.ai-search-result:last-child {
    border-bottom: none;
}

.ai-search-result:hover,
.ai-search-result.selected {
    background-color: #f8f8f8;
}

.ai-search-result:active {
    background-color: #f0f0f0;
}

/* Result Image */
.result-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    overflow: hidden;
    border-radius: 6px;
    background: #f5f5f5;
}

.result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Result Content */
.result-content {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--wc-primary-color, #96588a);
    margin-bottom: 2px;
}

.result-rating {
    font-size: 14px;
    color: #f5a623;
}

/* No Results */
.ai-search-no-results {
    padding: 24px 16px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-search-container,
    .ai-search-wrapper {
        max-width: 100%;
    }
    
    .ai-search-input {
        padding: 10px 44px 10px 14px;
        font-size: 14px;
    }
    
    .result-image {
        width: 50px;
        height: 50px;
    }
    
    .result-title {
        font-size: 14px;
    }
    
    .result-price,
    .result-rating {
        font-size: 13px;
    }
    
    .ai-search-dropdown {
        max-height: 300px;
    }
}

/* Admin Preview Styles */
.ai-search-preview {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-top: 16px;
}

.ai-search-preview .ai-search-container {
    pointer-events: none;
}

.ai-search-preview .ai-search-input {
    cursor: not-allowed;
}

.ai-search-results-preview {
    position: relative;
    top: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.placeholder-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 200%;
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        background-position: 100% 0%;
    }
    100% {
        background-position: -100% 0%;
    }
}

/* WooCommerce Integration */
.woocommerce-product-search .ai-search-wrapper {
    margin: 0;
}

/* RTL Support */
[dir="rtl"] .ai-search-icon,
[dir="rtl"] .ai-search-loading {
    right: auto;
    left: 16px;
}

[dir="rtl"] .ai-search-input {
    padding: 12px 16px 12px 48px;
}

