/* =========================================================
   Dalicia — Carrito, Modal de sabor y Lluvia de dulces
   ========================================================= */

:root {
    --accent: #0d0b09;
    --accent-soft: #0d0b0912;
    --accent-contrast: #ffffff;
}

/* ---------- Botones "en general" reaccionan al sabor activo ---------- */
.btn,
.cart,
.pack.active,
.flavor-card button,
.flavor-modal-close,
.whatsapp-float {
    transition: background-color .35s ease, border-color .35s ease, color .35s ease,
        box-shadow .35s ease, transform .15s ease;
}

.btn,
.cart,
.pack.active {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: var(--accent-contrast) !important;
    box-shadow: 0 8px 20px -8px var(--accent);
}

.flavor-card button {
    border: 1px solid var(--accent) !important;
    color: var(--accent) !important;
    background: transparent !important;
}

.flavor-card {
    cursor: pointer;
}

.flavor-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

/* ---------- Contador de sabores del "armador" ---------- */
#flavorSelect .counter button {
    cursor: pointer;
}

#flavorSelect article.qty-invalid {
    outline: 1px dashed #c0392b;
    outline-offset: 3px;
}

/* ---------- Toast (fallback por si main.css no la define) ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translate(-50%, 20px);
    background: #0d0b09;
    color: #fff;
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease, transform .3s ease;
    z-index: 10001;
    max-width: 90vw;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- Modal de sabor ---------- */
.flavor-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 11, 9, .62);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
}

.flavor-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.flavor-modal {
    background: #fff;
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    overflow: auto;
    border-radius: 22px;
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .45);
    transform: translateY(18px) scale(.96);
    transition: transform .32s cubic-bezier(.2, .8, .2, 1);
}

.flavor-modal-overlay.open .flavor-modal {
    transform: translateY(0) scale(1);
}

@media (min-width: 640px) {
    .flavor-modal {
        grid-template-columns: 1fr 1fr;
    }
}

.flavor-modal-media {
    min-height: 220px;
    background: #f2ede6;
}

.flavor-modal-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.flavor-modal-body {
    padding: 34px 32px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.flavor-modal-body .eyebrow {
    color: var(--accent);
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-size: 12px;
}

.flavor-modal-body h3 {
    margin: 0;
    font-size: 26px;
    line-height: 1.1;
}

.flavor-modal-body p {
    margin: 0;
    color: #55504a;
    line-height: 1.5;
}

.flavor-modal-body .btn {
    margin-top: 10px;
    align-self: flex-start;
}

.flavor-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, .07) !important;
    color: #0d0b09 !important;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    z-index: 2;
}

/* ---------- Resumen del pedido (por si main.css no los define) ---------- */
#summaryItems .summary-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    font-size: 14px;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
}

#summaryItems .summary-pack {
    font-weight: 600;
    border-bottom: none;
    padding-top: 10px;
}

#summaryItems .summary-empty {
    font-size: 14px;
    color: #837a6f;
    padding: 6px 0;
}

/* Contador visual en el icono del carrito del header */
.icon-btn[aria-label="Carrito"] {
    position: relative;
}

.icon-btn[aria-label="Carrito"][data-count]:not([data-count="0"])::after {
    content: attr(data-count);
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--accent);
    color: var(--accent-contrast);
    font-size: 10px;
    line-height: 1;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* ---------- Lluvia de dulces ---------- */
.candy-rain {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 9998;
}

.candy-piece {
    position: absolute;
    top: -10%;
    font-size: 26px;
    will-change: transform, opacity;
    animation-name: candy-fall;
    animation-timing-function: cubic-bezier(.4, 0, .6, 1);
    animation-fill-mode: forwards;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .18));
}

@keyframes candy-fall {
    0% {
        transform: translateY(-10vh) rotate(0deg);
        opacity: 0;
    }

    8% {
        opacity: 1;
    }

    100% {
        transform: translateY(112vh) rotate(340deg);
        opacity: 0;
    }
}