/* =========================================================
   Offcanvas Mini-Cart (independente de Bootstrap JS)
   ========================================================= */
:root {
    --ec-off-z: 1055;
    --ec-off-w: 380px;
    --ec-off-bg: #fff;
    --ec-off-border: #e9defc;
    --ec-off-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    --ec-brand: #3a2e85;
}

/* Container */
.offcanvas {
    position: fixed;
    inset: 0;
    z-index: var(--ec-off-z);
    pointer-events: none;
    visibility: hidden;
}

.offcanvas.show {
    pointer-events: auto;
    visibility: visible;
}

/* Overlay */
.offcanvas .offcanvas-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    transition: opacity .22s ease;
    pointer-events: none;
}

.offcanvas.show .offcanvas-backdrop {
    opacity: 1;
    pointer-events: auto;
}

/* Painel */
.offcanvas .offcanvas-panel {
    position: absolute;
    top: 0;
    height: 100%;
    width: min(100vw, var(--ec-off-w));
    background: var(--ec-off-bg);
    border-left: 1px solid var(--ec-off-border);
    display: flex;
    flex-direction: column;
    outline: none;
    box-shadow: none; /* sem sombra quando fechado */
    transition: transform .28s cubic-bezier(.22, 1, .36, 1);
}

/* Direita (padrão) */
.offcanvas.offcanvas-end .offcanvas-panel {
    right: 0;
    transform: translateX(100%);
}

.offcanvas.show.offcanvas-end .offcanvas-panel {
    transform: translateX(0);
    box-shadow: var(--ec-off-shadow);
}

/* Opcional: esquerda */
.offcanvas.offcanvas-start .offcanvas-panel {
    left: 0;
    border-left: none;
    border-right: 1px solid var(--ec-off-border);
    transform: translateX(-100%);
}

.offcanvas.show.offcanvas-start .offcanvas-panel {
    transform: translateX(0);
    box-shadow: var(--ec-off-shadow);
}

/* Header */
.offcanvas .offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
}

.offcanvas .offcanvas-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--ec-brand);
}

/* Botão fechar */
.button-close {
    appearance: none;
    border: 1px solid var(--ec-off-border);
    background: #f7f7fb;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.button-close:hover {
    background: #efeff6;
}

/* Body */
.offcanvas .offcanvas-body {
    flex: 1 1 auto;
    overflow: auto;
}

/* Vazio */
.ec-empty {
    text-align: center;
    padding: 24px 12px;
}

.is-hidden {
    display: none !important;
}

/* Itens */
.ec-cart-items {
    display: grid;
    gap: 10px;
    padding: 10px 16px;
    margin: 0;
    list-style: none;
}

.ec-cart-item {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 10px;
    align-items: center;
    border: 1px dashed var(--ec-off-border);
    border-radius: 10px;
    padding: 8px;
}

/* Coluna do meio (onde ficam título e qty) — é o 2º filho do grid */
.ec-cart-item > :nth-child(2) {
    display: flex;
    flex-direction: column;
    justify-content: center; /* centraliza verticalmente o bloco de texto */
    gap: 2px; /* aproxima título do meta (qty) */
    min-height: 48px; /* ajuda a equalizar visualmente quando os títulos são curtos */
}

.ec-cart-item__img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
}

/* título sem negrito e com no máximo 2 linhas */
.ec-cart-item__title {
    font-weight: 500;
    font-size: clamp(0.60rem, 2.2vw, 0.80rem);
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    margin: 0;
}

.ec-cart-item__meta {
    font-size: .85rem;
    color: #666;
    margin: 0;
    line-height: 1.2;
}

.ec-cart-item__price {
    text-align: right;
    align-self: center;
    font-size: .850rem;
    font-weight: 800;
    color: #3a2e85;
    white-space: nowrap;
    min-width: 88px;
}

.ec-cart-item__price .old {
    display: block;
    font-weight: 600;
    font-size: .85rem;
    color: var(--ec-brand);
    text-decoration: line-through;
}

/* Recomendados */
.cart-recommended .ec-rec {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.cart-recommended .ec-rec .thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
}

.cart-recommended .ec-rec .title {
    font-size: .92rem;
    font-weight: 600;
    margin: 0;
}

.cart-recommended .ec-rec .price {
    font-weight: 700;
    color: var(--ec-brand);
    font-size: .92rem;
}

/* Rodapé */
.offcanvas .offcanvas-footer {
    border-top: 1px solid var(--ec-off-border);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    padding: 12px 14px;
    font-weight: 800;
    text-decoration: none;
}

.btn-primary {
    background: var(--ec-brand);
    color: #fff;
    border: 1px solid var(--ec-brand);
}

.btn-outline-light {
    background: #fff;
    color: #333;
    border: 1px solid var(--ec-off-border);
}

.ec-cart-item__meta {
    margin-top: 2px;
    font-size: .82rem;
    color: #777;
}

.ec-cart-item {
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .06s ease;
}

.ec-cart-item:hover,
.ec-cart-item:focus-within {
    background-color: rgba(58, 46, 133, 0.06); /* roxinho suave */
    border-color: #d9d6ee;
    box-shadow: 0 2px 10px rgba(58, 46, 133, 0.12);
}

/* Feedback ao clicar (opcional) */
.ec-cart-item:active {
    transform: scale(0.998);
}

/* Deixa o título com feedback visual no hover */
.ec-cart-item:hover .ec-cart-item__title,
.ec-cart-item:focus-within .ec-cart-item__title {
    text-decoration: underline;
}

/* 1) Foto centralizada horizontalmente na 1ª coluna */
.ec-cart-item > a:first-child,
.ec-cart-item > .ec-cart-item__img {
    justify-self: center; /* centro na coluna */
}

.ec-cart-item__img {
    display: block; /* garante cálculo do centro certinho */
}

/* 2) “Qtd” antes da quantidade (sem mexer no JS) */
.ec-cart-item__meta::before {
    content: "Quantidade: ";
    font-weight: 600;
    color: #555;
}

/* Se não houver quantidade, não mostra o prefixo */
.ec-cart-item__meta:empty::before {
    content: "";
}

/* 3) Aumentar a fonte do preço (lado direito) */
.ec-cart-item__price .new {
    font-size: clamp(1.02rem, 2.8vw, 1.18rem); /* maior que antes */
    font-weight: 800;
}

.ec-cart-item__price .old {
    font-size: .88rem;
}

/* (opcional) Se quiser o preço CENTRALIZADO na coluna, ative também: */
/*
.ec-cart-item__price{
  text-align: center;
  justify-self: center;
  min-width: 100px;
}
*/

.rating {
    position: relative;
    display: inline-block;
    line-height: 1
}

.rating::before {
    content: "★★★★★";
    letter-spacing: 3px;
    color: #ddd;
    font-size: 12px
}

.rating .product_rate {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    overflow: hidden
}

.rating .product_rate::before {
    content: "★★★★★";
    letter-spacing: 3px;
    color: #f5a623;
    font-size: 12px
}

/* Responsivo */
@media (max-width: 480px) {
    :root {
        --ec-off-w: 92vw;
    }

    .ec-cart-item {
        grid-template-columns: 56px 1fr auto;
    }

    .ec-cart-item__img {
        width: 56px;
        height: 56px;
    }
}