/* Quando o modal estiver aberto, trava o scroll da página */
body.zai-vis-modal-open {
    overflow: hidden;
}

.zai-vis-wrapper {
    display: inline-block;
    position: relative;
}

/* Reseta o botão para não pegar estilo do tema */
.zai-vis-trigger,
.zai-vis-trigger:hover,
.zai-vis-trigger:focus {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0;
    cursor: pointer;
    border-radius: 0 !important;
}

/* Garante que o tema não limite o tamanho do ícone */
.zai-vis-icon-img {
    display: inline-block;
    max-width: none !important;
    height: auto;
}

.zai-vis-icon {
    display: inline-block;
}

/* ===== MODAL RESPONSIVO ===== */
.zai-vis-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 9999;
    font-family: inherit;
}

/* fundo */
.zai-vis-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}

/* container principal */
.zai-vis-modal-content {
    position: relative;
    max-width: 840px;
    width: 100%;
    margin: 32px auto;
    background: #fff;
    border-radius: 12px;
    padding: 24px 24px 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    z-index: 2;

    max-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
}

/* área scrollável (form + resultados dentro do modal) */
.zai-vis-modal-content-inner {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px; /* espaço pro scroll */
}

/* Título + botão fechar */
.zai-vis-title {
    font-size: 20px;
    margin: 0 32px 4px 0;
}

.zai-vis-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
}

.zai-vis-subtitle {
    margin-top: 0;
    margin-bottom: 16px;
    color: #666;
    font-size: 14px;
}

/* FORM / UPLOAD */
.zai-vis-dropzone {
    border: 1px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin-bottom: 16px;
    position: relative;
    background: #fafafa;
}

.zai-vis-dropzone input[type="file"] {
    opacity: 0;
    position: absolute;
    inset: 0;
    cursor: pointer;
}

.zai-vis-dropzone p {
    margin: 0 0 8px;
    font-size: 14px;
    color: #555;
}

.zai-vis-upload-btn {
    margin-top: 4px;
    padding: 8px 18px;
    border-radius: 6px;
    border: none;
    background: #111;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
}

/* Preview */
.zai-vis-preview-wrap {
    margin: 12px 0 16px;
    text-align: left;
}

.zai-vis-preview-label {
    margin: 0 0 6px;
    font-size: 12px;
    color: #555;
}

.zai-vis-preview-img {
    max-width: 140px;
    max-height: 140px;
    border-radius: 6px;
    border: 1px solid #eee;
    object-fit: cover;
}

/* Ações (botão buscar) */
.zai-vis-actions {
    margin-top: 4px;
    text-align: right;
}

.zai-vis-submit-btn {
    padding: 10px 22px;
    border-radius: 999px;
    border: none;
    background: #e91e63;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

/* Status */
.zai-vis-status {
    margin-top: 8px;
    font-size: 13px;
    color: #666;
}

/* Resultados dentro do modal (ainda existe, mas opcional) */
.zai-vis-results-wrap {
    margin-top: 20px;
}

.zai-vis-results-title {
    margin: 0 0 10px;
    font-size: 16px;
}

/* grid base reaproveitado */
.zai-vis-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 4px;
}

.zai-vis-product {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    font-size: 13px;
    background: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.zai-vis-product a {
    text-decoration: none;
    color: inherit;
}

.zai-vis-product img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 6px;
    border-radius: 6px;
}

.zai-vis-product-title {
    margin: 0 0 4px;
    font-size: 13px;
    min-height: 2.6em;
}

.zai-vis-product-price {
    font-weight: 600;
    color: #111;
}

/* hover card */
.zai-vis-product:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

/* ===== PAINEL DE RESULTADOS FORA DO MODAL ===== */
.zai-vis-results-panel {
    margin-top: 12px;
    max-width: 960px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    padding: 16px 18px 18px;
    font-size: 14px;
}

.zai-vis-results-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.zai-vis-results-panel-title {
    font-weight: 600;
    font-size: 15px;
}

.zai-vis-new-search {
    border: none;
    border-radius: 999px;
    padding: 6px 14px;
    background: #111;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
}

.zai-vis-results-panel-message {
    margin: 0 0 10px;
    color: #666;
    font-size: 13px;
}

/* Reaproveita o grid existente para os resultados externos */
.zai-vis-results-external .zai-vis-products-grid {
    margin-top: 0;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
    .zai-vis-modal-content {
        margin: 16px;
        padding: 18px 16px 16px;
        max-height: calc(100vh - 32px);
    }

    .zai-vis-title {
        font-size: 18px;
        margin-right: 28px;
    }

    .zai-vis-actions {
        text-align: center;
    }

    .zai-vis-submit-btn {
        width: 100%;
    }

    .zai-vis-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }

    .zai-vis-results-panel {
        margin-top: 8px;
        padding: 14px 12px 14px;
    }

    .zai-vis-results-panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .zai-vis-new-search {
        width: 100%;
        text-align: center;
    }
}
