/**
 * Visual Search - Frontend Styles
 *
 * All classes prefixed with "vs-" to avoid conflicts
 * with PrestaShop Classic and Hummingbird themes.
 */

/* ============================================
   Search Button
   ============================================ */

.vs-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    vertical-align: middle;
    margin-left: 8px;
}

.vs-search-button:hover {
    background: #f5f5f5;
    border-color: #999;
    color: #000;
}

.vs-search-button:active {
    background: #eee;
}

.vs-search-button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ============================================
   Modal Overlay
   ============================================ */

.vs-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.vs-modal-overlay.vs-active {
    display: flex;
}

/* ============================================
   Modal Container
   ============================================ */

.vs-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

.vs-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}

.vs-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.vs-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s;
}

.vs-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.vs-modal-body {
    padding: 24px;
}

/* ============================================
   Dropzone
   ============================================ */

.vs-dropzone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
}

.vs-dropzone:hover,
.vs-dropzone.vs-dragover {
    border-color: #2fb5d2;
    background: #f0fafe;
}

.vs-dropzone-icon {
    font-size: 48px;
    margin-bottom: 12px;
    color: #999;
}

.vs-dropzone-text {
    font-size: 16px;
    color: #666;
    margin-bottom: 8px;
}

.vs-dropzone-hint {
    font-size: 13px;
    color: #999;
}

.vs-dropzone input[type="file"] {
    display: none;
}

/* ============================================
   Preview
   ============================================ */

.vs-preview {
    display: none;
    margin-top: 16px;
    text-align: center;
}

.vs-preview.vs-active {
    display: block;
}

.vs-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    border: 1px solid #eee;
    object-fit: contain;
}

.vs-preview-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    justify-content: center;
}

.vs-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.vs-btn-primary {
    background: #2fb5d2;
    color: #fff;
}

.vs-btn-primary:hover {
    background: #25a0bb;
}

.vs-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.vs-btn-secondary:hover {
    background: #e0e0e0;
}

.vs-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   Spinner
   ============================================ */

.vs-spinner-container {
    display: none;
    text-align: center;
    padding: 40px 0;
}

.vs-spinner-container.vs-active {
    display: block;
}

.vs-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #eee;
    border-top: 3px solid #2fb5d2;
    border-radius: 50%;
    animation: vs-spin 0.8s linear infinite;
}

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

.vs-spinner-text {
    margin-top: 12px;
    font-size: 14px;
    color: #666;
}

/* ============================================
   Results Grid
   ============================================ */

.vs-results {
    display: none;
    margin-top: 20px;
}

.vs-results.vs-active {
    display: block;
}

.vs-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.vs-results-header h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.vs-results-count {
    font-size: 13px;
    color: #999;
}

.vs-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

/* ============================================
   Product Card
   ============================================ */

.vs-product-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.vs-product-card:hover {
    border-color: #ccc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.vs-product-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #f8f8f8;
    display: block;
}

.vs-product-info {
    padding: 12px;
}

.vs-product-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin: 0 0 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vs-product-price {
    font-size: 15px;
    font-weight: 700;
    color: #2fb5d2;
    margin: 0 0 6px;
}

/* ============================================
   Score Badge
   ============================================ */

.vs-score-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.vs-score-high {
    background: #e8f5e9;
    color: #2e7d32;
}

.vs-score-medium {
    background: #fff3e0;
    color: #ef6c00;
}

.vs-score-low {
    background: #fce4ec;
    color: #c62828;
}

/* ============================================
   Error Message
   ============================================ */

.vs-error {
    display: none;
    padding: 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    font-size: 14px;
    margin-top: 16px;
    text-align: center;
}

.vs-error.vs-active {
    display: block;
}

/* ============================================
   No Results
   ============================================ */

.vs-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.vs-no-results-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ============================================
   Mobile Responsive
   ============================================ */

@media (max-width: 768px) {
    .vs-modal-overlay {
        padding: 0;
    }

    .vs-modal {
        max-width: 100%;
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
    }

    .vs-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .vs-search-button span {
        display: none;
    }

    .vs-search-button {
        padding: 8px 10px;
        margin-left: 4px;
    }

    .vs-dropzone {
        padding: 30px 16px;
    }

    .vs-modal-body {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .vs-results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .vs-product-info {
        padding: 8px;
    }
}
