/* ── Visual Search Plugin — Styles ── */

/* Widget container */
.vs-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 680px;
    margin: 0 auto;
}

/* Drop zone */
.vs-dropzone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    background: #fafafa;
}
.vs-dropzone:hover,
.vs-dropzone:focus {
    border-color: #6366f1;
    background: #f5f3ff;
    outline: none;
}
.vs-dropzone.vs-drag-over {
    border-color: #6366f1;
    background: #ede9fe;
}
.vs-dropzone input[type="file"] {
    display: none;
}
.vs-dz-inner svg {
    color: #9ca3af;
    margin-bottom: 0.75rem;
}
.vs-hint {
    font-size: 15px;
    color: #374151;
    margin: 0 0 4px;
    font-weight: 500;
}
.vs-hint-sub {
    font-size: 13px;
    color: #9ca3af;
    margin: 0;
}

/* Preview */
.vs-preview-wrap {
    position: relative;
    display: inline-block;
}
.vs-preview-wrap img {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}
.vs-clear-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Search button */
.vs-actions {
    margin-top: 1rem;
    text-align: center;
}
.vs-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.vs-search-btn:hover { background: #4f46e5; }
.vs-search-btn:active { transform: scale(0.98); }

/* Loading spinner */
.vs-status {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-top: 1.25rem;
    color: #6b7280;
    font-size: 14px;
}
.vs-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: vs-spin 0.7s linear infinite;
}
@keyframes vs-spin { to { transform: rotate(360deg); } }

/* Results */
.vs-results-wrap { margin-top: 1.5rem; }
.vs-results-heading {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.vs-results-heading #vs-results-count {
    background: #ede9fe;
    color: #6366f1;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}
.vs-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

/* Result card */
.vs-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.vs-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: #c7d2fe;
    text-decoration: none;
    color: inherit;
}
.vs-card-img {
    width: 100% !important;
    height: auto !important;
    max-height: 200px !important;
    object-fit: contain !important;
    display: block !important;
    background: transparent !important;
}
.vs-card-img-placeholder {
    width: 100%;
    height: 120px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d1d5db;
    font-size: 32px;
}
.vs-card-body {
    padding: 10px 12px;
}
.vs-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 5px;
}
.vs-badge-product {
    background: #dbeafe;
    color: #1d4ed8;
}
.vs-badge-post {
    background: #d1fae5;
    color: #065f46;
}
.vs-card-title {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    margin: 0 0 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.vs-card-meta {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}
/* WooCommerce price inside card */
.vs-card-meta .woocommerce-Price-amount { color: #059669; font-weight: 600; }

/* Error message */
.vs-error {
    margin-top: 1rem;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #b91c1c;
    font-size: 14px;
}

/* ── Unified search bar wrapper ── */
.vs-search-bar-wrap {
    display: flex !important;
    align-items: center !important;
    background: #2c2c2e;
    border-radius: 50px;
    padding: 0 72px 0 18px !important; /* Extra padding on right for absolute camera and AI buttons */
    height: 48px;
    gap: 0;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Force standard theme form and labels to stretch */
.vs-search-bar-wrap form {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
}
.vs-search-bar-wrap form label,
.vs-search-bar-wrap form div,
.vs-search-bar-wrap form > * {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
}

/* Search icon (left) */
.vs-search-bar-wrap .vs-bar-search-icon {
    color: #6b6b70;
    font-size: 18px;
    flex-shrink: 0;
    margin-right: 10px;
    display: flex;
    align-items: center;
    cursor: pointer !important;
}
.vs-search-bar-wrap .vs-bar-search-icon:hover {
    color: #fff;
}

/* Native WP search input inside our bar */
.vs-search-bar-wrap input[type="search"],
.vs-search-bar-wrap input[type="text"] {
    flex: 1 !important;
    width: 100% !important;
    max-width: none !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-size: 15px;
    color: #e5e5ea;
    padding: 0 !important; /* Padding handled by parent container now */
    height: auto;
    min-height: 0;
}
.vs-search-bar-wrap input[type="search"]::placeholder,
.vs-search-bar-wrap input[type="text"]::placeholder {
    color: #6b6b70;
}

/* Hide theme's default submit button which may overlap or break the layout */
.vs-search-bar-wrap button[type="submit"],
.vs-search-bar-wrap input[type="submit"],
.vs-search-bar-wrap .search-submit {
    display: none !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Thin divider between text input and camera */
.vs-bar-divider {
    display: none !important;
}

/* Camera trigger button — inline in search bar */
.vs-camera-trigger {
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    padding: 5px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #8e8e93;
    border-radius: 50% !important;
    transition: background 0.15s, color 0.15s !important;
    flex-shrink: 0 !important;
    font-size: 20px;
    line-height: 1;
    position: absolute !important;
    right: 38px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 999999 !important;
    pointer-events: auto !important;
}
.vs-camera-trigger:hover {
    background: #3a3a3c !important;
    color: #e5e5ea !important;
}
.vs-camera-trigger:active {
    transform: scale(0.92) !important;
}

/* Floating button */
.vs-float-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #6366f1;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(99,102,241,0.45);
    transition: transform 0.2s, box-shadow 0.2s;
}
.vs-float-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(99,102,241,0.55);
}

/* Modal overlay */
.vs-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.vs-modal {
    background: #fff;
    border-radius: 16px;
    padding: 1.75rem;
    max-width: 640px;
    width: 100%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.vs-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 4px;
}
.vs-modal-close:hover { background: #f3f4f6; }

/* Responsive */
@media (max-width: 480px) {
    .vs-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .vs-modal { padding: 1.25rem; }
}
