/* AI Image Search - Professional Frontend Styles */

.ai-image-search {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    border: 1px solid grey;
    border-radius: 4px;
}

.ai-image-search::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
    pointer-events: none;
}

.ai-image-search-form {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.ai-image-search h2 {
    text-align: center;
    margin: 0 0 30px 0;
    font-size: 28px;
    font-weight: 700;
}

.ai-upload-area {
    border: 3px dashed #858586;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 25px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
}

.ai-upload-area:hover {
    border-color: #858586;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    transform: translateY(-2px);
}

.ai-upload-area.dragover {  
    border-color: #858586;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    transform: scale(1.02);
}

.ai-upload-icon {
    font-size: 48px;
    color: #858586;
    margin-bottom: 15px;
    display: block;
}

.ai-upload-text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.ai-upload-subtext {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.ai-file-input {
    display: none;
}

.ai-text-filter {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 16px;
    margin-bottom: 25px;
    transition: all 0.3s ease;
    background: #fff;
}

.ai-text-filter:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-search-button {
    width: 100%;
    padding: 18px 30px;
    border: none;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ai-search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.ai-search-button:active {
    transform: translateY(0);
}

.ai-search-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.ai-search-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.ai-search-button:hover::before {
    left: 100%;
}

.ai-search-status {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s ease;
}

.ai-search-status.loading {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.ai-search-status.success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(16, 185, 129, 0.1));
    color: #059669;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.ai-search-status.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.ai-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.ai-product-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.ai-product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.ai-product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.ai-product-card:hover::before {
    transform: scaleX(1);
}

.ai-product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 15px;
    transition: transform 0.3s ease;
}

.ai-product-card:hover img {
    transform: scale(1.05);
}

.ai-product-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #333;
    line-height: 1.4;
}

.ai-product-card .price {
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 15px;
    display: block;
}

.ai-product-card .button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
}

.ai-product-card .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
    color: white;
    text-decoration: none;
}

.ai-product-card .out-of-stock {
    color: #ef4444;
    font-weight: 600;
    font-size: 14px;
}

/* Loading Animation */
.ai-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-image-search {
        margin: 20px;
        padding: 20px;
        border-radius: 16px;
    }
    
    .ai-image-search-form {
        padding: 25px;
    }
    
    .ai-image-search h2 {
        font-size: 24px;
    }
    
    .ai-upload-area {
        padding: 30px 15px;
    }
    
    .ai-search-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }
}

/* AI-themed animations */
@keyframes ai-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.ai-upload-area.ai-processing {
    animation: ai-pulse 2s infinite;
}

.ai-upload-area.error {
    border-color: #ef4444 !important;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1)) !important;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Custom scrollbar for results */
.ai-search-results::-webkit-scrollbar {
    width: 8px;
}

.ai-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.ai-search-results::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

.ai-search-results::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
}
