/* Visual Product Search - Frontend Styles */

.vps-search-form {
    max-width: 800px;
    margin: 40px auto;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.vps-search-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.vps-search-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.vps-upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    background: #fafafa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.vps-upload-area:hover,
.vps-upload-area.drag-over {
    border-color: #2271b1;
    background: #f0f6fc;
}

.vps-upload-content .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    color: #999;
    margin-bottom: 15px;
}

.vps-upload-content p {
    margin: 15px 0;
    color: #666;
    font-size: 16px;
}

.vps-preview {
    position: relative;
}

.vps-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    display: block;
    margin: 0 auto 15px;
}

#vps-search-button {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#vps-search-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Search Results */
.vps-search-results {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid #eee;
}

.vps-search-results h3 {
    margin-bottom: 30px;
    font-size: 24px;
}

.vps-results-count {
    color: #666;
    font-weight: normal;
    font-size: 18px;
}

/* Products Grid */
.vps-products-grid {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.vps-products-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.vps-products-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.vps-products-grid[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.vps-product-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.vps-product-item:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transform: translateY(-5px);
}

.vps-product-item a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.vps-product-image {
    position: relative;
    padding-top: 100%;
    background: #f5f5f5;
    overflow: hidden;
}

.vps-product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vps-similarity-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(34, 113, 177, 0.9);
    color: #fff;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.vps-product-info {
    padding: 15px;
}

.vps-product-info h3 {
    margin: 0 0 10px;
    font-size: 16px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vps-product-price {
    font-size: 18px;
    font-weight: bold;
    color: #2271b1;
}

.vps-no-results {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 18px;
}

/* Loading Spinner */
.vps-search-loading {
    text-align: center;
    padding: 40px;
}

.vps-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2271b1;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: vps-spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Modal */
.vps-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vps-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
}

.vps-modal-content {
    position: relative;
    max-width: 900px;
    max-height: 90vh;
    width: 90%;
    background: #fff;
    border-radius: 8px;
    overflow-y: auto;
    z-index: 1;
}

.vps-modal-close {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.vps-modal-close:hover {
    background: #f5f5f5;
}

.vps-modal-close .dashicons {
    font-size: 20px;
}

.vps-modal-body {
    padding: 20px;
}

/* Shop Search Button */
.vps-shop-search-button {
    margin-bottom: 20px;
}

.vps-open-search-modal {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Similar Products Widget */
.vps-similar-products {
    margin: 40px 0;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 8px;
}

.vps-similar-products h2 {
    margin-top: 0;
    margin-bottom: 30px;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .vps-products-grid[data-columns="3"],
    .vps-products-grid[data-columns="4"] {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .vps-products-grid {
        grid-template-columns: 1fr !important;
    }
    
    .vps-upload-area {
        padding: 30px 15px;
    }
    
    .vps-modal-content {
        width: 95%;
    }
}
