/* ─── Buscador Visual — Estilos ─────────────────────────────────────── */

/* Variables de color — inspiradas en VectorForge */
.bv-wrapper {
    --bv-bg:          #0e0e0e;
    --bv-surface:     #161616;
    --bv-border:      rgba(255,255,255,0.10);
    --bv-border-hover:rgba(255,255,255,0.22);
    --bv-accent:      #ffffff;
    --bv-accent-dim:  rgba(255,255,255,0.60);
    --bv-text:        #f0f0f0;
    --bv-muted:       #888;
    --bv-radius:      12px;
    --bv-radius-sm:   8px;
    --bv-tag-bg:      rgba(255,255,255,0.07);
    --bv-tag-text:    rgba(255,255,255,0.80);
    --bv-green:       #22c55e;
    --bv-btn-bg:      #ffffff;
    --bv-btn-text:    #0e0e0e;

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--bv-text);
    background: var(--bv-bg);
    border-radius: 20px;
    padding: 32px 28px 40px;
    max-width: 1100px;
    margin: 0 auto;
    box-sizing: border-box;
}

*, *::before, *::after { box-sizing: inherit; }

/* ─── Search box ───────────────────────────────────────────────────── */

.bv-search-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ─── Dropzone ─────────────────────────────────────────────────────── */

.bv-dropzone {
    position: relative;
    border: 1.5px dashed var(--bv-border);
    border-radius: var(--bv-radius);
    background: var(--bv-surface);
    transition: border-color .2s, background .2s;
    cursor: pointer;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.bv-dropzone:hover,
.bv-dropzone.drag-over {
    border-color: var(--bv-border-hover);
    background: #1e1e1e;
}

.bv-dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px;
    text-align: center;
    color: var(--bv-muted);
    pointer-events: none;
}

.bv-dropzone-inner svg {
    opacity: .45;
}

.bv-dropzone-inner p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.bv-dropzone-inner span {
    font-size: 12px;
    color: #555;
}

.bv-file-label {
    color: var(--bv-accent-dim);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    pointer-events: all;
}

.bv-file-label:hover {
    color: var(--bv-accent);
}

/* Previsualización de imagen */
.bv-preview {
    position: relative;
    width: 100%;
    height: 180px;
}

.bv-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.bv-clear-img {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}

.bv-clear-img:hover {
    background: rgba(0,0,0,0.85);
}

/* ─── Fila de texto + botón ────────────────────────────────────────── */

.bv-text-row {
    display: flex;
    gap: 10px;
}

.bv-text-input {
    flex: 1;
    background: var(--bv-surface);
    border: 1.5px solid var(--bv-border);
    border-radius: var(--bv-radius-sm);
    color: var(--bv-text);
    font-size: 15px;
    padding: 0 16px;
    height: 48px;
    outline: none;
    transition: border-color .2s;
}

.bv-text-input::placeholder {
    color: #555;
}

.bv-text-input:focus {
    border-color: var(--bv-border-hover);
}

.bv-search-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--bv-btn-bg);
    color: var(--bv-btn-text);
    border: none;
    border-radius: var(--bv-radius-sm);
    font-size: 14px;
    font-weight: 600;
    padding: 0 22px;
    height: 48px;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity .15s, transform .1s;
}

.bv-search-btn:hover  { opacity: .88; }
.bv-search-btn:active { transform: scale(.97); }

.bv-search-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* ─── Loading ──────────────────────────────────────────────────────── */

.bv-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 36px 0;
    color: var(--bv-muted);
    font-size: 14px;
}

.bv-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(255,255,255,0.10);
    border-top-color: rgba(255,255,255,0.70);
    border-radius: 50%;
    animation: bv-spin .7s linear infinite;
}

@keyframes bv-spin {
    to { transform: rotate(360deg); }
}

/* ─── Tags detectados ──────────────────────────────────────────────── */

.bv-tags-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.bv-tags-label {
    font-size: 12px;
    color: var(--bv-muted);
    white-space: nowrap;
}

.bv-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bv-tag {
    background: var(--bv-tag-bg);
    color: var(--bv-tag-text);
    border: 1px solid var(--bv-border);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    letter-spacing: .02em;
}

/* ─── Cabecera de resultados ───────────────────────────────────────── */

.bv-results-header {
    margin-top: 24px;
    font-size: 13px;
    color: var(--bv-muted);
}

/* ─── Grid de productos ────────────────────────────────────────────── */

.bv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.bv-card {
    background: var(--bv-surface);
    border: 1px solid var(--bv-border);
    border-radius: var(--bv-radius);
    overflow: hidden;
    transition: border-color .2s, transform .2s;
    text-decoration: none;
    display: block;
    color: inherit;
}

.bv-card:hover {
    border-color: var(--bv-border-hover);
    transform: translateY(-3px);
}

.bv-card-img-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #111;
}

.bv-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}

.bv-card:hover .bv-card-img-wrap img {
    transform: scale(1.04);
}

.bv-badge-sale {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
}

.bv-card-body {
    padding: 12px 14px 14px;
}

.bv-card-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--bv-text);
    margin: 0 0 6px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bv-card-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--bv-accent);
}

.bv-card-price del {
    font-weight: 400;
    color: var(--bv-muted);
    font-size: 12px;
    margin-right: 4px;
}

.bv-card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
}

.bv-stars {
    color: #facc15;
    font-size: 11px;
    letter-spacing: .05em;
}

.bv-rating-count {
    font-size: 11px;
    color: var(--bv-muted);
}

/* ─── Sin resultados ───────────────────────────────────────────────── */

.bv-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 52px 0;
    color: var(--bv-muted);
    text-align: center;
}

.bv-empty svg {
    opacity: .25;
}

.bv-empty p {
    margin: 0;
    font-size: 15px;
    color: #666;
}

.bv-empty span {
    font-size: 13px;
    color: #444;
}

/* ─── Paginación ───────────────────────────────────────────────────── */

.bv-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 28px;
}

.bv-page-btn {
    background: var(--bv-surface);
    border: 1px solid var(--bv-border);
    color: var(--bv-text);
    border-radius: var(--bv-radius-sm);
    padding: 7px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s;
}

.bv-page-btn:hover:not(:disabled) {
    border-color: var(--bv-border-hover);
}

.bv-page-btn:disabled {
    opacity: .3;
    cursor: not-allowed;
}

.bv-page-info {
    font-size: 13px;
    color: var(--bv-muted);
    padding: 0 8px;
}

/* ─── Error inline ─────────────────────────────────────────────────── */

.bv-error {
    background: rgba(239,68,68,.10);
    border: 1px solid rgba(239,68,68,.30);
    color: #f87171;
    border-radius: var(--bv-radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    margin-top: 12px;
}

/* ─── Responsive ───────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .bv-wrapper {
        padding: 20px 16px 28px;
        border-radius: 12px;
    }

    .bv-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .bv-text-row {
        flex-direction: column;
    }

    .bv-search-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ─── Integración con Divi (override mínimo) ───────────────────────── */
.et_pb_module .bv-wrapper,
.et-db .bv-wrapper {
    width: 100%;
}
