/* ==========================================================================
   weVideo — Compra dentro do vídeo (barra, gavetas, sacola) e Provador IA
   Carregado junto com frontend.css.
   ========================================================================== */

.wevideo-stories-container {
    --wv-sheet-bg: #fff;
    --wv-sheet-text: #111;
    --wv-muted: #6b6b6b;
    --wv-line: #ececec;
    --wv-dark: #111;
}

.wevideo-stories-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wv-cartbtn {
    position: relative;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 50% !important;
    background: #0000005c !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ícones desenhados por background (sem fonte de ícones), imunes a estilos de tema em <i> */
.wv-cartbtn i,
.wevideo-stories-control[data-action="products"] i,
.wevideo-stories-control.wv-ext i {
    display: block !important;
    flex: 0 0 auto;
    width: 22px !important;
    height: 22px !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0 !important;
    line-height: 0 !important;
    opacity: 1 !important;
    background-color: transparent !important;
    background-size: 22px 22px !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

.wv-cartbtn i::before,
.wevideo-stories-control[data-action="products"] i::before,
.wevideo-stories-control.wv-ext i::before {
    content: none !important;
}

.wv-cartbtn i {
    width: 18px !important;
    height: 18px !important;
    background-size: 18px 18px !important;
    /* carrinho */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E") !important;
}

.wevideo-stories-control[data-action="products"] i {
    /* sacola de compras */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z'/%3E%3Cline x1='3' y1='6' x2='21' y2='6'/%3E%3Cpath d='M16 10a4 4 0 0 1-8 0'/%3E%3C/svg%3E") !important;
}

.wevideo-stories-control {
    position: relative;
}

.wv-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ff2d55;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-sizing: border-box;
    display: none;
    pointer-events: none;
}

.wv-badge.bump {
    animation: wv-bump 0.4s ease;
}

@keyframes wv-bump {
    0% { transform: scale(1); }
    40% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* Trilho de controles acima da barra de compra */
.wevideo-stories-controls {
    top: auto;
    bottom: 190px;
    transform: none;
}

/* ---- Barra de compra ---- */

.wv-shopbar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    padding: 40px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
    display: none;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}

.wv-shopbar.active {
    display: flex;
    animation: slideUpFade 0.35s ease forwards;
}

.wv-shopbar__more {
    align-self: flex-start;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 4px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(8px);
    color: #fff !important;
    font-size: 12px !important;
    font-weight: 600;
    cursor: pointer;
}

.wv-shopbar__thumbs {
    display: flex;
}

.wv-shopbar__thumbs img {
    width: 24px !important;
    height: 24px !important;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
    margin-left: -8px;
}

.wv-shopbar__thumbs img:first-child {
    margin-left: 0;
}

.wv-shopbar__card {
    display: flex !important;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    color: #111 !important;
    text-align: left;
    cursor: pointer;
}

.wv-shopbar__thumb {
    flex: 0 0 48px;
    width: 48px !important;
    height: 48px !important;
    border-radius: 8px;
    object-fit: cover;
}

.wv-shopbar__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wv-shopbar__title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.wv-shopbar__price,
.wv-plist__price {
    font-size: 14px;
    font-weight: 700;
}

.wv-shopbar__price del,
.wv-plist__price del,
.wv-pd__price del {
    opacity: 0.55;
    font-weight: 400;
    font-size: 0.85em;
    margin-right: 4px;
}

.wv-shopbar__price ins,
.wv-plist__price ins,
.wv-pd__price ins {
    text-decoration: none;
}

.wv-shopbar__price .screen-reader-text,
.wv-plist__price .screen-reader-text,
.wv-pd__price .screen-reader-text,
.wv-cart__total .screen-reader-text,
.wv-cart__subtotal .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

.wv-shopbar__chevron {
    font-size: 22px;
    color: #999;
    padding-right: 4px;
}

.wv-shopbar__add {
    width: 100%;
    margin: 0 !important;
    padding: 13px 16px !important;
    font-size: 15px !important;
    border-radius: 10px;
}

.wv-shopbar__add:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---- Gaveta (bottom sheet) ---- */

.wv-sheet-backdrop {
    position: absolute;
    inset: 0;
    z-index: 28;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.wv-sheet-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.wv-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 29;
    max-height: 82%;
    display: flex;
    flex-direction: column;
    background: var(--wv-sheet-bg);
    color: var(--wv-sheet-text);
    border-radius: 18px 18px 0 0;
    transform: translateY(105%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.wv-sheet.active {
    transform: translateY(0);
}

.wv-sheet__handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: #d5d5d5;
    margin: 8px auto 0;
}

.wv-sheet__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 10px;
    border-bottom: 1px solid var(--wv-line);
}

.wv-sheet__title {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.wv-sheet__back,
.wv-sheet__close {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 50% !important;
    background: #f2f2f2 !important;
    color: #111 !important;
    font-size: 22px !important;
    line-height: 1 !important;
    cursor: pointer;
}

.wv-sheet__body {
    flex: 1 1 auto;
    min-height: 0; /* sem isso o item flex cresce com o conteúdo e não rola */
    overflow-y: auto;
    touch-action: pan-y pinch-zoom;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 14px 16px 18px;
}

.wv-spinner {
    width: 32px;
    height: 32px;
    margin: 30px auto;
    border: 3px solid #e5e5e5;
    border-top-color: #111;
    border-radius: 50%;
    animation: wevideo-spin 0.8s linear infinite;
}

.wv-empty {
    text-align: center;
    color: var(--wv-muted);
    padding: 24px 0;
    margin: 0;
}

/* ---- Botões ---- */

.wv-btn {
    position: relative;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px !important;
    margin: 0 !important;
    border-radius: 10px !important;
    border: 1.5px solid transparent !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
    text-transform: none !important;
    cursor: pointer;
    box-sizing: border-box;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.wv-btn:active {
    transform: scale(0.98);
}

.wv-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.wv-btn--dark {
    background: var(--wv-dark) !important;
    color: #fff !important;
}

.wv-btn--outline {
    background: #fff !important;
    color: var(--wv-dark) !important;
    border-color: var(--wv-dark) !important;
}

.wv-btn--block {
    display: flex !important;
    width: 100%;
}

.wv-btn--sm {
    padding: 8px 14px !important;
    font-size: 12px !important;
}

.wv-btn.is-loading,
.wevideo-buy-button.is-loading {
    position: relative;
    color: transparent !important;
}

.wv-btn.is-loading::after,
.wevideo-buy-button.is-loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wevideo-spin 0.7s linear infinite;
}

.wv-btn--outline.is-loading::after {
    border-color: rgba(0, 0, 0, 0.2);
    border-top-color: #111;
}

/* ---- Lista de produtos ---- */

.wv-plist {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wv-plist__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--wv-line);
    border-radius: 12px;
    background: #fafafa;
    cursor: pointer;
}

.wv-plist__row.is-featured {
    border-color: #111;
    background: #fff;
}

.wv-plist__thumb {
    flex: 0 0 56px;
    width: 56px !important;
    height: 56px !important;
    border-radius: 8px;
    object-fit: cover;
}

.wv-plist__info {
    flex: 1;
    min-width: 0;
}

.wv-plist__title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wv-plist__price {
    margin-top: 4px;
}

/* ---- Detalhe do produto ---- */

.wv-pd__media {
    position: relative;
    margin: 0 -16px 12px;
}

.wv-pd__gallery {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 16px;
    scrollbar-width: none;
    padding: 0 16px;
    touch-action: pan-x pan-y pinch-zoom;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.wv-pd__gallery.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    scroll-behavior: auto;
}

.wv-pd__gallery img {
    -webkit-user-drag: none;
    pointer-events: none;
}

.wv-pd__nav {
    position: absolute;
    top: calc(50% - 12px);
    transform: translateY(-50%);
    z-index: 2;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.95) !important;
    color: #111 !important;
    font-size: 22px !important;
    line-height: 1 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.wv-pd__nav--prev { left: 22px; }
.wv-pd__nav--next { right: 22px; }

.wv-pd__nav:disabled {
    opacity: 0;
    pointer-events: none;
}

.wv-pd__dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding-top: 10px;
}

.wv-pd__dot {
    width: 7px !important;
    height: 7px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 4px !important;
    background: #d4d4d4 !important;
    cursor: pointer;
    transition: width 0.2s ease, background-color 0.2s ease;
}

.wv-pd__dot.is-active {
    width: 18px !important;
    background: #111 !important;
}

@media (hover: none) {
    .wv-pd__nav {
        display: none !important;
    }
}

.wv-pd__gallery::-webkit-scrollbar {
    display: none;
}

.wv-pd__gallery img {
    flex: 0 0 72%;
    max-width: 260px;
    aspect-ratio: 1 / 1;
    width: 72% !important;
    height: auto !important;
    object-fit: cover;
    border-radius: 12px;
    scroll-snap-align: start;
    background: #f4f4f4;
    pointer-events: none;
}

.wv-pd__price {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 12px;
}

.wv-pd__attr {
    margin-bottom: 12px;
}

.wv-pd__attr-label {
    font-size: 13px;
    color: var(--wv-muted);
    margin-bottom: 6px;
}

.wv-pd__attr-label b {
    color: var(--wv-sheet-text);
}

.wv-pd__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wv-chip {
    min-width: 44px;
    padding: 8px 12px !important;
    margin: 0 !important;
    border: 1.5px solid #d9d9d9 !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #111 !important;
    font-size: 13px !important;
    font-weight: 600;
    line-height: 1.2 !important;
    cursor: pointer;
}

.wv-chip.is-selected {
    border-color: #111 !important;
    background: #111 !important;
    color: #fff !important;
}

.wv-chip.is-unavailable {
    color: #aaa !important;
    text-decoration: line-through;
    border-style: dashed !important;
}

.wv-chip.is-unavailable.is-selected {
    background: #777 !important;
    color: #fff !important;
}

.wv-pd__stock {
    display: none;
    margin-bottom: 10px;
    font-size: 13px;
    color: #c0392b;
    font-weight: 600;
}

.wv-pd__stock.is-visible {
    display: block;
}

.wv-pd__qty {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--wv-muted);
}

.wv-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    overflow: hidden;
}

.wv-stepper button {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: #f5f5f5 !important;
    color: #111 !important;
    font-size: 18px !important;
    line-height: 1 !important;
    cursor: pointer;
}

.wv-stepper__value {
    min-width: 36px;
    text-align: center;
    font-weight: 700;
    color: #111;
}

.wv-stepper--sm button {
    width: 28px !important;
    height: 28px !important;
    font-size: 15px !important;
}

.wv-stepper--sm .wv-stepper__value {
    min-width: 28px;
    font-size: 13px;
}

.wv-pd__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.wv-pd__ext {
    margin-bottom: 12px !important;
}

.wv-pd__desc {
    font-size: 13px;
    line-height: 1.5;
    color: #444;
    margin: 4px 0 10px;
}

.wv-pd__link {
    display: block;
    text-align: center;
    font-size: 13px;
    color: var(--wv-muted) !important;
    text-decoration: underline !important;
    padding: 6px 0;
}

/* ---- Sacola ---- */

.wv-cart.is-busy {
    opacity: 0.55;
    pointer-events: none;
}

.wv-cart__items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.wv-cart__item {
    position: relative;
    display: flex;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--wv-line);
}

.wv-cart__item img {
    flex: 0 0 64px;
    width: 64px !important;
    height: 64px !important;
    border-radius: 8px;
    object-fit: cover;
}

.wv-cart__info {
    flex: 1;
    min-width: 0;
    padding-right: 24px;
}

.wv-cart__title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.wv-cart__meta {
    font-size: 12px;
    color: var(--wv-muted);
    margin-top: 2px;
}

.wv-cart__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.wv-cart__total {
    font-size: 14px;
    font-weight: 700;
}

.wv-cart__remove {
    position: absolute;
    top: 0;
    right: 0;
    width: 24px !important;
    height: 24px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    color: #999 !important;
    font-size: 20px !important;
    line-height: 1 !important;
    cursor: pointer;
}

.wv-cart__subtotal {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    font-size: 15px;
}

.wv-cart__subtotal b {
    font-size: 18px;
}

@media (min-width: 769px) {
    .wevideo-stories-container {
        border-radius: 16px;
        height: min(100%, 860px);
    }
}

/* ==========================================================================
   Blindagem contra estilos de tema
   Muitos temas estilizam todo <button> (altura mínima, margem, position,
   maiúsculas, alinhamento). Aqui garantimos o visual do Stories em qualquer tema.
   ========================================================================== */

.wevideo-stories-popup button {
    -webkit-appearance: none;
    appearance: none;
    text-transform: none !important;
    letter-spacing: normal !important;
    text-shadow: none;
    font-family: inherit;
}

/* Botões redondos: topo, trilho lateral, setas e gavetas */
.wevideo-stories-popup .wevideo-stories-header-actions > button,
.wevideo-stories-popup .wevideo-stories-control,
.wevideo-stories-popup .wevideo-stories-nav,
.wevideo-stories-popup .wv-sheet__back,
.wevideo-stories-popup .wv-sheet__close {
    box-sizing: border-box !important;
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    outline-offset: 2px;
}

.wevideo-stories-popup .wevideo-stories-header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    flex: 0 0 auto;
    margin: 0 !important;
}

.wevideo-stories-popup .wevideo-stories-header-actions > button {
    width: 34px !important;
    height: 34px !important;
    background: rgba(0, 0, 0, 0.36) !important;
    color: #fff !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.wevideo-stories-popup .wevideo-stories-header-actions > button:hover {
    background: rgba(0, 0, 0, 0.55) !important;
    transform: none;
}

.wevideo-stories-popup .wevideo-stories-close {
    font-size: 22px !important;
    font-weight: 400 !important;
}

.wevideo-stories-popup .wv-cartbtn .wv-badge {
    top: -3px;
    right: -3px;
}

.wevideo-stories-popup .wevideo-stories-control {
    width: 44px !important;
    height: 44px !important;
}

.wevideo-stories-popup .wv-sheet__back,
.wevideo-stories-popup .wv-sheet__close {
    width: 32px !important;
    height: 32px !important;
}

/* Card do produto: texto sempre alinhado à esquerda */
.wevideo-stories-popup .wv-shopbar__card,
.wevideo-stories-popup .wv-shopbar__info,
.wevideo-stories-popup .wv-shopbar__title,
.wevideo-stories-popup .wv-shopbar__price {
    text-align: left !important;
}

.wevideo-stories-popup .wv-shopbar__info {
    align-items: flex-start !important;
}

.wevideo-stories-popup .wv-shopbar__add,
.wevideo-stories-popup .wv-btn {
    min-height: 0 !important;
    height: auto !important;
    line-height: 1.2 !important;
    box-shadow: none;
}

/* Setas escondidas quando não há para onde navegar */
.wevideo-stories-popup .wevideo-stories-nav[hidden] {
    display: none !important;
}

/* Arrasto entre produtos: o container é animado via JS */
.wevideo-stories-container {
    will-change: transform, opacity;
    transform-origin: 50% 50%;
}

/* A blindagem acima força display nos botões; este bloco respeita os que o player esconde */
.wevideo-stories-popup .wevideo-stories-header-actions > button[style*="display: none"],
.wevideo-stories-popup .wevideo-stories-control[style*="display: none"],
.wevideo-stories-popup .wv-sheet__back[style*="display: none"],
.wevideo-stories-popup .wv-sheet__close[style*="display: none"] {
    display: none !important;
}
