/* ============ ENHANCEMENTS — recursos avançados ============ */

/* SCROLL PROGRESS BAR */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-deep) 0%, var(--gold) 50%, var(--gold-light) 100%);
    z-index: 9999;
    transition: width 0.05s linear;
    box-shadow: 0 0 12px rgba(245, 184, 0, 0.5);
}

/* CURSOR TRAIL */
.trail-dot {
    position: fixed;
    width: 14px;
    height: 14px;
    pointer-events: none;
    z-index: 9997;
    transition: opacity 0.4s;
    will-change: transform, opacity;
}
@media (max-width: 900px) { .trail-dot { display: none; } }

/* CART FLOATING BUTTON */
.cart-fab {
    position: fixed;
    bottom: 6.5rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    background: var(--ink);
    color: var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(26, 26, 26, 0.3);
    z-index: 49;
    border: none;
    cursor: none;
    transition: all 0.35s var(--ease-out);
    opacity: 0;
    transform: translateY(20px) scale(0.7);
    pointer-events: none;
}
.cart-fab.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.cart-fab:hover {
    background: var(--gold);
    color: var(--ink);
    transform: scale(1.08);
}
.cart-fab .cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #E74C3C;
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid var(--paper);
    animation: cartPulse 0.4s var(--ease-out);
}
@keyframes cartPulse {
    0% { transform: scale(0.4); }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); }
}
@media (max-width: 900px) { .cart-fab { cursor: pointer; bottom: 5.5rem; right: 1rem; } }

/* CART DRAWER */
.cart-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s, visibility 0.35s;
}
.cart-drawer-overlay.open { opacity: 1; visibility: visible; }

.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(440px, 92vw);
    background: var(--paper);
    z-index: 1001;
    transform: translateX(105%);
    transition: transform 0.45s var(--ease-out);
    display: flex;
    flex-direction: column;
    box-shadow: -20px 0 60px rgba(0,0,0,0.25);
}
.cart-drawer.open { transform: translateX(0); }

.cart-drawer-head {
    padding: 1.8rem 2rem 1.4rem;
    border-bottom: 1px solid rgba(42,42,42,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cart-drawer-head h3 {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.7rem;
    font-weight: 600;
    line-height: 1;
    color: var(--ink);
}
.cart-drawer-head .subtitle {
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--gold-deep);
    font-weight: 700;
    margin-bottom: 0.3rem;
    display: block;
}
.cart-drawer-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid rgba(42,42,42,0.15);
    color: var(--ink);
    cursor: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-size: 1.4rem;
    line-height: 1;
}
.cart-drawer-close:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
@media (max-width: 900px) { .cart-drawer-close { cursor: pointer; } }

.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.4rem 2rem;
}
.cart-empty {
    text-align: center;
    padding: 3rem 1rem;
}
.cart-empty svg {
    margin: 0 auto 1.2rem;
    opacity: 0.35;
}
.cart-empty h4 {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.4rem;
    color: var(--ink);
    margin-bottom: 0.5rem;
}
.cart-empty p {
    color: rgba(42,42,42,0.55);
    font-size: 0.95rem;
    line-height: 1.5;
}

.cart-item {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 1rem;
    padding: 1.2rem 0;
    border-bottom: 1px dashed rgba(42,42,42,0.12);
    align-items: center;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-icon {
    width: 60px; height: 60px;
    border-radius: 12px;
    background: var(--icon-bg, var(--cream));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
}
.cart-item-icon .mini-pop {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--pop-color, #FDF8EC);
    box-shadow:
        inset -3px -4px 8px rgba(0,0,0,0.15),
        inset 3px 3px 8px rgba(255,255,255,0.35);
    position: relative;
}
.cart-item-icon .mini-pop::before {
    content: '';
    position: absolute;
    top: 15%; left: 22%;
    width: 30%; height: 22%;
    background: rgba(255,255,255,0.6);
    border-radius: 50%;
    filter: blur(1px);
}
.cart-item-info h5 {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--ink);
    line-height: 1.1;
    margin-bottom: 0.25rem;
    font-weight: 600;
}
.cart-item-info .cart-item-size {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(42,42,42,0.55);
    font-weight: 600;
}
.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}
.cart-item-price {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--ink);
    font-weight: 700;
}
.cart-qty {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--cream);
    border-radius: 20px;
    padding: 0.2rem;
}
.cart-qty button {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--paper);
    border: 1px solid rgba(42,42,42,0.15);
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: none;
    transition: all 0.2s;
}
.cart-qty button:hover { background: var(--gold); border-color: var(--gold); }
.cart-qty span {
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}
@media (max-width: 900px) { .cart-qty button { cursor: pointer; } }

.cart-drawer-foot {
    padding: 1.5rem 2rem 2rem;
    background: var(--cream);
    border-top: 1px solid rgba(42,42,42,0.08);
}
.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.2rem;
}
.cart-total-label {
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(42,42,42,0.6);
    font-weight: 700;
}
.cart-total-value {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 2rem;
    color: var(--ink);
    font-weight: 700;
}
.cart-checkout {
    display: block;
    width: 100%;
    padding: 1.1rem;
    background: var(--ink);
    color: var(--paper);
    text-align: center;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    transition: all 0.3s;
    border: none;
    cursor: none;
    box-shadow: 0 10px 30px rgba(26, 26, 26, 0.2);
}
.cart-checkout:hover { background: var(--gold); color: var(--ink); transform: translateY(-2px); }
.cart-checkout:disabled { opacity: 0.4; cursor: not-allowed; }
.cart-clear {
    display: block;
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.7rem;
    background: transparent;
    color: rgba(42,42,42,0.5);
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 600;
    border: none;
    cursor: none;
    transition: color 0.3s;
}
.cart-clear:hover { color: #E74C3C; }
@media (max-width: 900px) { .cart-checkout, .cart-clear { cursor: pointer; } }

/* TOAST */
.toast-stack {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    pointer-events: none;
}
.toast {
    background: var(--ink);
    color: var(--paper);
    padding: 1rem 1.4rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 260px;
    max-width: 360px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
    transform: translateX(-120%);
    opacity: 0;
    transition: transform 0.45s var(--ease-out), opacity 0.35s;
    border-left: 3px solid var(--gold);
    pointer-events: auto;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast .toast-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 900;
}
.toast .toast-body { flex: 1; font-size: 0.9rem; line-height: 1.35; }
.toast .toast-body strong {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.1rem;
    color: var(--gold-light);
}
@media (max-width: 500px) {
    .toast-stack { bottom: 5.5rem; left: 1rem; right: 1rem; }
    .toast { min-width: 0; max-width: none; }
}

/* TILT 3D on flavor cards */
.flavor-card { transform-style: preserve-3d; will-change: transform; }
.flavor-card .flavor-visual,
.flavor-card .flavor-name,
.flavor-card .flavor-tag {
    transform: translateZ(20px);
    transition: transform 0.4s var(--ease-out);
}
.flavor-card .flavor-number {
    transform: translateZ(40px);
}

/* ADD-TO-CART button in flavor card foot */
.flavor-add {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    border: 1.5px solid rgba(42,42,42,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: none;
    transition: all 0.3s var(--ease-out);
    flex-shrink: 0;
}
.flavor-add:hover { background: var(--gold); border-color: var(--gold); transform: scale(1.15); }
.flavor-add.added {
    background: #27AE60;
    border-color: #27AE60;
    color: white;
    animation: checkPop 0.5s var(--ease-out);
}
@keyframes checkPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}
@media (max-width: 900px) { .flavor-add { cursor: pointer; } }

.flavor-card-foot-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* PRODUCT PAGE — add to cart button variant */
.btn-cart {
    background: var(--paper);
    color: var(--ink);
    border: 1.5px solid var(--ink);
}
.btn-cart:hover {
    background: var(--ink);
    color: var(--gold);
    transform: translateY(-3px);
}
.btn-cart.added { background: #27AE60; color: white; border-color: #27AE60; }

/* ANIMATED COUNTER */
.stat-num[data-target] { display: inline-block; }

/* LIGHTBOX */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s, visibility 0.35s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(253, 248, 236, 0.1);
    border: 1px solid rgba(253, 248, 236, 0.2);
    color: var(--paper);
    font-size: 1.6rem;
    cursor: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 2;
}
.lightbox-close:hover { background: rgba(253, 248, 236, 0.2); transform: rotate(90deg); }
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px; height: 56px;
    border-radius: 50%;
    background: rgba(253, 248, 236, 0.08);
    border: 1px solid rgba(253, 248, 236, 0.15);
    color: var(--paper);
    font-size: 1.4rem;
    cursor: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 2;
}
.lightbox-nav:hover { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.lightbox-prev { left: 2rem; }
.lightbox-next { right: 2rem; }
@media (max-width: 900px) {
    .lightbox-nav { cursor: pointer; width: 44px; height: 44px; }
    .lightbox-prev { left: 0.8rem; }
    .lightbox-next { right: 0.8rem; }
    .lightbox-close { cursor: pointer; }
}

.lightbox-content {
    max-width: min(1100px, 90vw);
    max-height: 85vh;
    aspect-ratio: 4/5;
    background: var(--ink);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.45s var(--ease-out);
}
.lightbox.open .lightbox-content { transform: scale(1); }
.lightbox-content .lb-visual {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: var(--lb-bg);
}
.lightbox-info {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 2rem 2.5rem;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.75) 100%);
    color: var(--paper);
}
.lightbox-info h4 {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.6rem;
    margin-bottom: 0.3rem;
}
.lightbox-info span {
    font-size: 0.8rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    opacity: 0.8;
}

/* FRESHNESS INDICATOR */
.freshness {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    background: rgba(39, 174, 96, 0.1);
    border: 1px solid rgba(39, 174, 96, 0.3);
    border-radius: 50px;
    font-size: 0.75rem;
    color: #1E8449;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
}
.freshness .pulse {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #27AE60;
    box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.6);
    animation: freshnessPulse 1.8s ease-in-out infinite;
}
@keyframes freshnessPulse {
    0% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(39, 174, 96, 0); }
    100% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0); }
}

/* ANIMATED HERO POPS - burst animation */
.hero-burst {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 500px; height: 500px;
    pointer-events: none;
    z-index: 2;
    display: none;
}
@media (min-width: 900px) { .hero-burst { display: block; } }
.hero-burst .burst-pop {
    position: absolute;
    width: 26px; height: 26px;
    border-radius: 50%;
    top: 50%; left: 50%;
    box-shadow: inset -3px -4px 8px rgba(0,0,0,0.15), inset 3px 3px 8px rgba(255,255,255,0.35);
    animation: burstOut 4.5s ease-out infinite;
    opacity: 0;
}
.hero-burst .burst-pop::before {
    content: '';
    position: absolute;
    top: 15%; left: 22%;
    width: 30%; height: 22%;
    background: rgba(255,255,255,0.6);
    border-radius: 50%;
    filter: blur(1px);
}
@keyframes burstOut {
    0% { transform: translate(-50%, -50%) rotate(var(--angle)) translateX(0) scale(0); opacity: 0; }
    15% { opacity: 1; }
    100% { transform: translate(-50%, -50%) rotate(var(--angle)) translateX(320px) scale(1); opacity: 0; }
}

/* 404 PAGE */
.err-page {
    min-height: 100vh;
    padding: 6rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(180deg, var(--paper) 0%, var(--cream) 100%);
    position: relative;
    overflow: hidden;
}
.err-page .container { max-width: 700px; position: relative; z-index: 2; }
.err-code {
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(9rem, 22vw, 16rem);
    line-height: 0.9;
    color: var(--gold-deep);
    font-weight: 700;
    letter-spacing: -0.05em;
    margin-bottom: 1rem;
    text-shadow: 6px 6px 0 var(--ink);
}
.err-title {
    font-family: var(--font-hand);
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--ink);
    line-height: 1;
    margin-bottom: 1.2rem;
}
.err-desc {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.2rem;
    color: rgba(42,42,42,0.7);
    line-height: 1.5;
    margin-bottom: 2.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}
.err-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}
.err-fallen-pops {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 160px;
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    padding: 0 5%;
    pointer-events: none;
    opacity: 0.4;
}
.err-fallen-pops .fp {
    width: 40px; height: 40px;
    animation: sadWobble 4s ease-in-out infinite;
}
.err-fallen-pops .fp:nth-child(1) { animation-delay: 0s; }
.err-fallen-pops .fp:nth-child(2) { animation-delay: 0.5s; }
.err-fallen-pops .fp:nth-child(3) { animation-delay: 1s; }
.err-fallen-pops .fp:nth-child(4) { animation-delay: 1.5s; }
.err-fallen-pops .fp:nth-child(5) { animation-delay: 2s; }
@keyframes sadWobble {
    0%, 100% { transform: translateY(0) rotate(-8deg); }
    50% { transform: translateY(-15px) rotate(8deg); }
}

/* NAV cart trigger in menu */
.nav-cart-btn {
    position: relative;
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1.5px solid var(--ink);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: none;
    transition: all 0.3s;
    color: var(--ink);
}
.nav-cart-btn:hover { background: var(--gold); border-color: var(--gold); }
.nav-cart-btn .count {
    position: absolute;
    top: -4px; right: -4px;
    background: #E74C3C;
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid var(--paper);
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s var(--ease-out);
}
.nav-cart-btn.has-items .count { opacity: 1; transform: scale(1); }
@media (max-width: 900px) { .nav-cart-btn { cursor: pointer; } }

/* PWA install prompt */
.pwa-prompt {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    background: var(--ink);
    color: var(--paper);
    padding: 1rem 1.4rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.35);
    z-index: 400;
    max-width: calc(100vw - 2rem);
    transition: transform 0.5s var(--ease-out);
}
.pwa-prompt.show { transform: translateX(-50%) translateY(0); }
.pwa-prompt-icon {
    width: 40px; height: 40px;
    background: var(--gold);
    color: var(--ink);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pwa-prompt-text { font-size: 0.9rem; line-height: 1.35; }
.pwa-prompt-text strong { color: var(--gold); }
.pwa-prompt button {
    padding: 0.6rem 1rem;
    background: var(--gold);
    color: var(--ink);
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    flex-shrink: 0;
}
.pwa-prompt-close {
    background: transparent !important;
    color: rgba(253,248,236,0.5) !important;
    padding: 0.3rem !important;
    font-size: 1.2rem !important;
    line-height: 1;
}
