/* Página de produto montada pelo editor de blocos (home_editor).
   Portado de loja/templates/loja/detalhe_produto.html — mesmas regras visuais,
   reorganizadas em classes "pv-*" por bloco independente (Título, Galeria,
   Preço, Variações, Botão, Descrição), já que cada um agora é arrastável e
   pode ficar em qualquer posição/coluna escolhida pelo lojista. */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.breadcrumb .sep { color: var(--outline-variant); font-size: 12px; letter-spacing: 0; }
.breadcrumb { min-width: 0; }
.breadcrumb a { color: var(--on-surface-variant); text-decoration: none; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .breadcrumb a:hover { color: var(--primary); } }
.breadcrumb .atual {
    color: var(--on-surface); text-transform: none; letter-spacing: 0;
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.pv-page { display: flex; flex-direction: column; }

/* ─── Título ─────────────────────────────────────────────── */
.pv-title__tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 10px;
}
.pv-title__tag::before {
    content: '';
    display: block;
    width: 18px;
    height: 1px;
    background: currentColor;
    opacity: 0.65;
}
.pv-title__nome {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 400;
    color: var(--on-surface);
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin: 0;
    overflow-wrap: anywhere;
}

/* ─── Galeria ────────────────────────────────────────────── */
/* Miniaturas em coluna vertical à esquerda; a foto principal preenche todo o quadro. */
.pv-gallery {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "thumbs main";
    align-items: stretch;
    background: var(--surface-container);
    border-radius: var(--r-lg);
    overflow: hidden;
}
.pv-gallery__placeholder { grid-column: 1 / -1; }
.pv-gallery__main {
    grid-area: main;
    aspect-ratio: 4 / 5;
    position: relative;
    cursor: zoom-in;
    overflow: hidden;
}
.pv-gallery__main img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.22s ease;
}
.pv-gallery__seta {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(251, 249, 245, 0.9);
    border: 1px solid var(--outline-variant);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    color: var(--on-surface);
    box-shadow: 0 2px 8px rgba(160, 82, 45, 0.10);
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    z-index: 2;
    opacity: 0;
}
@media (hover: hover) and (pointer: fine) { .pv-gallery__main:hover .pv-gallery__seta { opacity: 1; } }
@media (hover: hover) and (pointer: fine) { .pv-gallery__seta:hover {
    background: var(--surface);
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 4px 16px rgba(160, 82, 45, 0.15);
} }
.pv-gallery__seta--prev { left: 12px; }
.pv-gallery__seta--next { right: 12px; }
.pv-gallery__placeholder {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--outline);
}
.pv-gallery__placeholder i { font-size: 48px; opacity: 0.35; }
.pv-gallery__placeholder span {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.pv-gallery__thumbs {
    grid-area: thumbs;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 76px;
    padding: 10px 8px;
    box-sizing: border-box;
    /* contain:size => a altura da coluna não empurra a foto; ela acompanha a altura da foto e rola */
    contain: size;
    overflow-y: auto;
    scrollbar-width: none;
    background: rgba(251, 249, 245, 0.72);
    border-right: 1px solid var(--outline-variant);
}
.pv-gallery__thumbs::-webkit-scrollbar { display: none; }
.pv-gallery__thumbs img {
    width: 100%;
    aspect-ratio: 3 / 4;
    height: auto;
    object-fit: cover;
    border-radius: var(--r-md);
    cursor: pointer;
    flex-shrink: 0;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s, opacity 0.2s;
    opacity: 0.6;
}
@media (hover: hover) and (pointer: fine) { .pv-gallery__thumbs img:hover { opacity: 1; transform: scale(1.04); } }
.pv-gallery__thumbs img.ativa { border-color: var(--primary); opacity: 1; }

/* ─── Preço ──────────────────────────────────────────────── */
.pv-price {
    display: flex;
    align-items: baseline;
    gap: 5px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--outline-variant);
}
.pv-price__prefix {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 400;
    color: var(--on-surface-variant);
    align-self: flex-end;
    padding-bottom: 3px;
}
.pv-price__valor {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 400;
    color: var(--on-surface);
    letter-spacing: -0.02em;
    line-height: 1;
    transition: opacity 0.2s, transform 0.2s;
    display: block;
}

/* ─── Variações (cor / tamanho) ──────────────────────────── */
.pv-variations__group { margin-bottom: 14px; }
.pv-variations__label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.pv-variations__label-nome {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--on-surface-variant);
}
.pv-variations__label-val {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--on-surface);
    transition: color 0.2s;
}
.pv-variations__opcoes { display: flex; gap: 8px; flex-wrap: wrap; }
.pv-variations__opcao {
    padding: 8px 16px;
    border-radius: var(--r-full);
    border: 1.5px solid transparent;
    background: var(--surface-container-high);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--on-surface-variant);
    transition: border-color 0.18s, background 0.18s, color 0.18s, transform 0.15s;
}
@media (hover: hover) and (pointer: fine) { .pv-variations__opcao:hover:not(:disabled) {
    border-color: var(--outline-variant);
    color: var(--on-surface);
    transform: translateY(-1px);
} }
.pv-variations__opcao.selecionado {
    background: var(--secondary-container);
    color: var(--on-secondary-container);
    font-weight: 600;
    border-color: transparent;
}
.pv-variations__opcao:disabled {
    opacity: 0.28;
    cursor: default;
    text-decoration: line-through;
}
.pv-variations__opcoes--cores-round .pv-variations__cor-swatch { border-radius: 50% !important; }
.pv-variations__opcoes--cores-square .pv-variations__cor-swatch { border-radius: 6px !important; }
.pv-variations__cor-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pv-variations__cor-nome-mobile {
    display: none;
    max-width: 60px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    color: var(--on-surface-variant);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pv-variations__cor-swatch {
    padding: 0 !important;
    width: 52px;
    height: 52px;
    border-radius: var(--r-md) !important;
    border: 2.5px solid transparent !important;
    background: var(--surface-container-high);
    overflow: hidden;
    position: relative;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
    transition: border-color 0.18s, transform 0.15s, box-shadow 0.18s !important;
    cursor: pointer;
}
.pv-variations__cor-swatch img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}
@media (hover: hover) and (pointer: fine) { .pv-variations__cor-swatch:hover:not(:disabled) {
    border-color: var(--outline-variant) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
} }
.pv-variations__cor-swatch.selecionado {
    border-color: transparent !important;
    box-shadow: 0 0 0 3px var(--surface-container-lowest), 0 0 0 5px var(--primary);
    background: var(--surface-container-high) !important;
}
.pv-variations__cor-swatch:disabled {
    opacity: 0.28;
    cursor: default;
}
.pv-variations__cor-swatch:disabled::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        -45deg, transparent, transparent 5px,
        rgba(0,0,0,0.18) 5px, rgba(0,0,0,0.18) 6px
    );
}
.pv-variations__msg-estoque {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    color: var(--on-error-container);
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--error-container);
    border-radius: var(--r);
    overflow: hidden;
    max-height: 0;
    padding: 0 10px;
    margin-bottom: 0;
    opacity: 0;
    transition: max-height 0.25s ease, padding 0.25s ease, margin-bottom 0.25s ease, opacity 0.2s ease;
}
.pv-variations__msg-estoque.visivel {
    max-height: 48px;
    padding: 8px 10px;
    margin-bottom: 16px;
    opacity: 1;
}
/* Pré-venda: aviso informativo (não é erro) com a previsão de envio */
.pv-variations__prevenda {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    margin-bottom: 16px;
    border-radius: var(--r);
    background: #fff7ed;
    color: #9a3412;
}
.pv-variations__prevenda[hidden] { display: none; }

/* ─── Botão de compra ────────────────────────────────────── */
.pv-button__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 24px;
    border-radius: var(--r-lg);
    border: none;
    background: var(--primary);
    color: var(--on-primary);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.22s, transform 0.18s, box-shadow 0.22s;
}
@media (hover: hover) and (pointer: fine) { .pv-button__cta:hover:not(:disabled) {
    background: var(--primary-container);
    transform: translateY(-2px);
    box-shadow: var(--shadow-btn);
} }
.pv-button__cta:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
.pv-button__cta:disabled {
    background: var(--surface-container-high);
    color: var(--outline);
    cursor: default;
}

/* ─── Descrição ──────────────────────────────────────────── */
.pv-description {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
    color: var(--on-surface-variant);
    line-height: 1.65;
}
.pv-description__texto {
    max-height: calc(var(--pv-clamp-lines, 6) * 1.65em);
    overflow: hidden;
    position: relative;
}
.pv-description__texto.aberta { max-height: none; }
/* Esmaece o fim do texto com máscara (não com uma faixa colorida por cima):
   funciona sobre qualquer fundo de seção, não só o branco. */
.pv-description__texto.recortada:not(.aberta) {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 2.5em), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 2.5em), transparent);
}
.pv-description__toggle {
    display: none;
    margin-top: 10px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}
.pv-description__toggle.visivel { display: inline-flex; align-items: center; gap: 6px; }

/* ─── Lightbox ───────────────────────────────────────────── */
.pv-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 8, 6, 0.94);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.pv-lightbox.aberto { display: flex; }
.pv-lightbox__inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pv-lightbox__inner img {
    max-width: 88vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: var(--r);
    display: block;
    transition: opacity 0.2s;
    user-select: none;
}
.pv-lightbox__fechar {
    position: fixed;
    top: 20px;
    right: 24px;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    font-size: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
@media (hover: hover) and (pointer: fine) { .pv-lightbox__fechar:hover { background: rgba(255,255,255,0.2); } }
.pv-lightbox__seta {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    font-size: 15px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 1001;
}
@media (hover: hover) and (pointer: fine) { .pv-lightbox__seta:hover { background: rgba(255,255,255,0.22); } }
.pv-lightbox__seta--prev { left: 20px; }
.pv-lightbox__seta--next { right: 20px; }
.pv-lightbox__seta[hidden] { display: none; }
.pv-lightbox__counter {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.45);
    font-family: var(--font-body);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ─── Cálculo de frete ───────────────────────────────────── */
.pv-frete { margin: 16px 0; padding: 14px 16px; border: 1px solid var(--outline-variant); border-radius: var(--r-md); font-family: var(--font-body); font-size: 13px; color: var(--on-surface); }
.pv-frete[hidden] { display: none; }
.pv-frete__titulo { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 10px; }
.pv-frete__form { display: flex; gap: 8px; }
.pv-frete__form input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--outline-variant); border-radius: 8px; background: transparent; color: inherit; font: inherit; }
.pv-frete__form button { height: 40px; padding: 0 18px; border: 0; border-radius: 8px; background: var(--on-surface); color: var(--surface, #fff); font: inherit; font-weight: 600; cursor: pointer; }
.pv-frete__form button:disabled { opacity: .6; cursor: progress; }
.pv-frete__ajuda { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--on-surface-variant, #666); text-decoration: underline; }
.pv-frete__lista { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.pv-frete__lista:empty { display: none; }
.pv-frete__lista li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--outline-variant); border-radius: 8px; }
.pv-frete__lista li small { display: block; color: var(--on-surface-variant, #666); }
.pv-frete__valor { font-weight: 600; white-space: nowrap; }
.pv-frete__valor--gratis { color: #1a7f4b; }
.pv-frete__erro { margin: 10px 0 0; color: #b3261e; }
.pv-frete__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ─── Responsivo ─────────────────────────────────────────── */
@media (max-width: 780px) {
    /* Celular: foto em cima ocupando o quadro, miniaturas em fila embaixo */
    .pv-gallery { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "thumbs"; }
    .pv-gallery__main { aspect-ratio: 4 / 5; max-height: 75vh; }
    .pv-gallery__seta { opacity: 1; width: 34px; height: 34px; }
    .pv-gallery__thumbs { flex-direction: row; width: auto; contain: none; overflow-x: auto; overflow-y: hidden; padding: 10px 12px; border-right: 0; border-top: 1px solid var(--outline-variant); }
    .pv-gallery__thumbs img { width: 60px; }
    .pv-title__nome { font-size: 22px; }
    .pv-variations__opcoes { gap: 10px; }
    .pv-variations__opcao:not(.pv-variations__cor-swatch) { min-height: 44px; min-width: 44px; }
    .pv-variations__cor-swatch { width: 48px; height: 48px; }
    .pv-variations__cor-nome-mobile { display: block; }
    .pv-lightbox__fechar { top: 12px; right: 12px; }
    .pv-lightbox__seta { width: 40px; height: 40px; }
    .pv-lightbox__seta--prev { left: 8px; }
    .pv-lightbox__seta--next { right: 8px; }
    .pv-lightbox__inner img { max-width: 96vw; max-height: 80vh; }
    .pv-lightbox__counter { bottom: 16px; }
}

@media (hover: none) {
    .pv-gallery__seta { opacity: 1; }
}
