/*
    assets/css/favoritos.css — FAVORITOS (23/10/2026, pedido do CW)
    Coração dos cards, botão da página do produto, aba "Favoritos" da área do cliente e o aviso rápido.
    Carregado pelo includes/layout.php em todas as páginas; o JS é o assets/js/componentes/favoritos.js.
*/

/* ---------- o coração (todas as variantes) ---------- */
.cw-fav {
    --fav-cor: #e11d48;
    --fav-borda: #9ca3af;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.cw-fav__ico {
    flex: 0 0 auto;
    fill: transparent;
    stroke: var(--fav-borda);
    stroke-width: 2;
    stroke-linejoin: round;
    transition: fill .15s ease, stroke .15s ease, transform .15s ease;
}
.cw-fav:hover .cw-fav__ico { stroke: var(--fav-cor); }
.cw-fav.is-ativo .cw-fav__ico { fill: var(--fav-cor); stroke: var(--fav-cor); }
.cw-fav.is-ativo.is-pulo .cw-fav__ico { animation: cw-fav-pulo .32s ease; }
.cw-fav[data-ocupado="1"] { opacity: .6; cursor: progress; }
.cw-fav:focus-visible { outline: 2px solid var(--fav-cor); outline-offset: 2px; }
@keyframes cw-fav-pulo { 0% { transform: scale(1); } 45% { transform: scale(1.3); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
    .cw-fav__ico { transition: none; }
    .cw-fav.is-ativo.is-pulo .cw-fav__ico { animation: none; }
}

/* ---------- no card (canto superior direito da foto) ---------- */
.cw-produto,
.cw-produto-relacionados__card { position: relative; }

.cw-fav--card {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}
.cw-fav--card:hover { background: #fff; }
@media (max-width: 480px) {
    .cw-fav--card { top: 6px; right: 6px; width: 32px; height: 32px; }
    .cw-fav--card .cw-fav__ico { width: 20px; height: 20px; }
}

/* ---------- na foto grande da página do produto (canto livre: a máscara ocupa topo-esquerda e base-direita) ---------- */
.cw-fav--foto {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;             /* acima da máscara (::after, z-index 2) */
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.cw-fav--foto:hover { background: #fff; }
.cw-fav--foto .cw-fav__ico { width: 26px; height: 26px; }
@media (max-width: 480px) {
    .cw-fav--foto { top: 8px; right: 8px; width: 40px; height: 40px; }
    .cw-fav--foto .cw-fav__ico { width: 23px; height: 23px; }
}

/* ---------- na página do produto (botão com texto, abaixo de Comprar/Carrinho) ---------- */
.cw-fav--produto {
    width: 100%;
    margin: 0 0 var(--espaco-3, 12px);
    padding: 10px 14px;
    border: 1px solid var(--cor-borda, #e5e7eb);
    border-radius: var(--raio-md, 10px);
    background: #fff;
    color: var(--cor-texto, #1f2937);
    font-weight: 600;
    font-size: var(--texto-sm, .9rem);
}
.cw-fav--produto:hover { border-color: var(--fav-cor); }
.cw-fav--produto.is-ativo { border-color: var(--fav-cor); color: var(--fav-cor); }
.cw-fav--produto .cw-fav__ico { width: 20px; height: 20px; }

/* ---------- aba "Favoritos" da área do cliente ---------- */
.cw-fav-lista {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.cw-fav-item {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--cor-borda, #e5e7eb);
    border-radius: var(--raio-md, 10px);
    overflow: hidden;
    position: relative;
    transition: opacity .25s ease, transform .25s ease;
}
.cw-fav-item.is-saindo { opacity: 0; transform: scale(.96); }
.cw-fav-item__foto { display: block; background: #fff; }
.cw-fav-item__foto img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; }
.cw-fav-item__corpo { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; flex: 1; }
.cw-fav-item__nome {
    margin: 0;
    font-size: var(--texto-sm, .9rem);
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}
.cw-fav-item__nome a { color: inherit; text-decoration: none; }
.cw-fav-item__preco { font-weight: 800; color: var(--cor-marca, #008a20); text-align: center; }
.cw-fav-item__acoes { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.cw-fav-item__acoes .cw-btn { width: 100%; justify-content: center; text-align: center; }
.cw-fav--remover {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--cor-borda, #e5e7eb);
    border-radius: var(--raio-md, 10px);
    background: #fff;
    color: #6b7280;
    font-size: .85rem;
}
.cw-fav--remover:hover { border-color: var(--fav-cor); color: var(--fav-cor); }
.cw-fav--remover .cw-fav__ico { width: 16px; height: 16px; }

/* produto que saiu do ar: esmaecido, com a etiqueta "indisponível" */
.cw-fav-item.is-indisponivel .cw-fav-item__foto,
.cw-fav-item.is-indisponivel .cw-fav-item__nome,
.cw-fav-item.is-indisponivel .cw-fav-item__preco { opacity: .5; filter: grayscale(.6); }
.cw-fav-item__etiqueta {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    padding: 3px 9px;
    border-radius: 12px;
    background: #6b7280;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.cw-fav-vazio {
    padding: 28px 16px;
    text-align: center;
    border: 1px dashed var(--cor-borda, #d1d5db);
    border-radius: var(--raio-md, 10px);
    color: #4b5563;
}
.cw-fav-vazio[hidden] { display: none; }
.cw-fav-contagem { font-size: .9rem; color: #6b7280; margin: 0 0 12px; }

/* ---------- aviso rápido ("Salvo nos favoritos") ---------- */
.cw-fav-toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    z-index: 100000;
    max-width: calc(100vw - 32px);
    padding: 10px 16px;
    border-radius: 999px;
    background: #1f2937;
    color: #fff;
    font-size: .92rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
    transform: translate(-50%, 16px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}
.cw-fav-toast.is-visivel { opacity: 1; transform: translate(-50%, 0); }
.cw-fav-toast--erro { background: #b91c1c; }
.cw-fav-toast a { color: #fde68a; text-decoration: underline; pointer-events: auto; }
