/* ============================================================
   Blocksy Mobile Bottom Menu v1.0.2 – Estilos principales
   ============================================================ */

/* ── Variables (hereda color-2 de Blocksy) ──────────────────── */
:root {
    --bmm-accent:      var(--theme-palette-color-2, #e74c3c);
    --bmm-accent-dark: color-mix(in srgb, var(--bmm-accent) 80%, black);
    --bmm-bg:          #ffffff;
    --bmm-bg-blur:     rgba(255, 255, 255, 0.95);
    --bmm-border:      rgba(0, 0, 0, 0.09);
    --bmm-text:        #333333;
    --bmm-text-muted:  #999999;
    --bmm-icon-size:   22px;
    --bmm-height:      62px;
    --bmm-shadow:      0 -2px 20px rgba(0, 0, 0, 0.10);
    --bmm-transition:  0.2s ease;
    --bmm-badge-size:  16px;
    --bmm-label-size:  10px;
}

/* ============================================================
   MENÚ INFERIOR
   CRÍTICO: NO usar display:none como estado inicial — impide
   las transiciones CSS. Usamos visibility + transform + opacity.
   En desktop forzamos display:none para que no ocupe espacio.
   ============================================================ */

/* Base — estructura siempre presente en el DOM */
#bmm-bottom-menu {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    height: var(--bmm-height);
    align-items: stretch;
    background: var(--bmm-bg-blur);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--bmm-border);
    box-shadow: var(--bmm-shadow);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: content-box;

    /* Estado inicial: fuera de pantalla (abajo) */
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px) + 4px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    /* Transición de salida: visibility se retrasa hasta que opacity llega a 0 */
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1),
                opacity   0.30s ease,
                visibility 0s linear 0.38s;
}

/* Desktop/tablet: ocultar completamente para no interferir con el layout */
@media (min-width: 768px) {
    #bmm-bottom-menu {
        display: none !important;
    }
    body.bmm-scrolled {
        padding-bottom: 0 !important;
    }
}

/* ── Solo móvil ─────────────────────────────────────────────── */
@media (max-width: 767px) {

    /* Estado visible: desliza de abajo hacia arriba */
    #bmm-bottom-menu.bmm-visible {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        /* Transición de entrada: visibility cambia inmediatamente */
        transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity   0.30s ease,
                    visibility 0s linear 0s;
    }

    /* Padding en body SOLO cuando el menú está visible */
    body.bmm-scrolled {
        padding-bottom: calc(var(--bmm-height) + env(safe-area-inset-bottom, 0px)) !important;
    }

    .bmm-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px 4px;
        color: var(--bmm-text-muted);
        text-decoration: none;
        position: relative;
        transition: color var(--bmm-transition);
        -webkit-tap-highlight-color: transparent;
        outline: none;
        font-family: inherit;
        min-width: 0;
    }

    .bmm-item:hover,
    .bmm-item:focus-visible {
        color: var(--bmm-accent);
    }

    .bmm-item.bmm-active {
        color: var(--bmm-accent);
    }

    .bmm-item.bmm-active::after {
        content: '';
        position: absolute;
        bottom: 5px;
        left: 50%;
        transform: translateX(-50%);
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background: var(--bmm-accent);
    }

    .bmm-icon {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: var(--bmm-icon-size);
        height: var(--bmm-icon-size);
        flex-shrink: 0;
    }

    .bmm-icon svg {
        width: 100%;
        height: 100%;
        display: block;
    }

    .bmm-label {
        font-size: var(--bmm-label-size);
        font-weight: 500;
        line-height: 1;
        letter-spacing: 0.03em;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .bmm-badge {
        position: absolute;
        top: 4px;
        right: calc(50% - 20px);
        min-width: var(--bmm-badge-size);
        height: var(--bmm-badge-size);
        border-radius: 99px;
        background: var(--bmm-accent);
        color: #fff;
        font-size: 9px;
        font-weight: 700;
        line-height: var(--bmm-badge-size);
        text-align: center;
        padding: 0 3px;
        pointer-events: none;
        transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                    opacity   0.18s ease;
    }

    .bmm-badge-hidden {
        transform: scale(0);
        opacity: 0;
    }

    .bmm-wishlist.bmm-wl-has-items .bmm-heart-icon svg path {
        fill: var(--bmm-accent);
        stroke: var(--bmm-accent);
        transition: fill 0.2s ease, stroke 0.2s ease;
    }

} /* fin @media movil */


/* ============================================================
   Botón corazón sobre imagen del producto
   (visible en todos los dispositivos)
   ============================================================ */

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
    position: relative;
}

.woocommerce-product-gallery {
    position: relative;
}

.bmm-heart-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    color: var(--bmm-accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.13);
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease,
                background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.bmm-heart-btn:hover,
.bmm-heart-btn:focus-visible {
    transform: scale(1.12);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.17);
    background: rgba(255, 255, 255, 1);
}

.bmm-heart-btn:active {
    transform: scale(0.90);
}

.bmm-heart-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity  0.15s ease,
                transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bmm-heart-btn .bmm-heart-outline {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.bmm-heart-btn .bmm-heart-filled {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.55);
}

.bmm-heart-btn--active .bmm-heart-outline {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.55);
}
.bmm-heart-btn--active .bmm-heart-filled {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.bmm-heart-btn--pulse .bmm-heart-filled {
    animation: bmm-heart-pulse 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bmm-heart-pulse {
    0%   { transform: translate(-50%, -50%) scale(0.55); }
    60%  { transform: translate(-50%, -50%) scale(1.35); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.bmm-heart--single {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
}

.bmm-heart--single svg {
    width: 20px;
    height: 20px;
}

.bmm-heart--wishlist-page {
    top: 8px;
    right: 8px;
}


/* ============================================================
   Modal aviso visitantes
   ============================================================ */

.bmm-guest-notice {
    display: none;
}

@media (max-width: 767px) {

    .bmm-guest-notice {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 999998;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
        padding: 20px;
        animation: bmm-fade-in 0.28s ease;
    }

    @keyframes bmm-fade-in {
        from { opacity: 0; }
        to   { opacity: 1; }
    }

    .bmm-guest-notice__inner {
        background: var(--bmm-bg);
        border-radius: 18px;
        padding: 36px 26px 28px;
        max-width: 360px;
        width: 100%;
        text-align: center;
        box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
        animation: bmm-slide-up 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    @keyframes bmm-slide-up {
        from { transform: translateY(32px) scale(0.95); opacity: 0; }
        to   { transform: translateY(0)    scale(1);    opacity: 1; }
    }

    .bmm-guest-notice__icon {
        width: 58px;
        height: 58px;
        margin: 0 auto 16px;
        color: var(--bmm-accent);
    }

    .bmm-guest-notice__icon svg {
        width: 100%;
        height: 100%;
    }

    .bmm-guest-notice h2 {
        margin: 0 0 10px;
        font-size: 1.25rem;
        color: var(--bmm-text);
    }

    .bmm-guest-notice p {
        margin: 0 0 20px;
        color: var(--bmm-text-muted);
        font-size: 0.875rem;
        line-height: 1.55;
    }

    .bmm-guest-notice__actions {
        display: flex;
        gap: 10px;
        justify-content: center;
        flex-wrap: wrap;
    }

    .bmm-guest-notice__disclaimer {
        margin-top: 14px !important;
        font-size: 0.76rem !important;
        color: var(--bmm-text-muted) !important;
    }

} /* fin @media movil */


/* ── Botones genéricos ───────────────────────────────────────── */
.bmm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 22px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    transition: background var(--bmm-transition),
                color       var(--bmm-transition),
                border-color var(--bmm-transition),
                transform   0.14s ease;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1;
}

.bmm-btn:active { transform: scale(0.96); }

.bmm-btn--primary  { background: var(--bmm-accent); color: #fff; border-color: var(--bmm-accent); }
.bmm-btn--primary:hover { background: var(--bmm-accent-dark); border-color: var(--bmm-accent-dark); color: #fff; }
.bmm-btn--secondary { background: transparent; color: var(--bmm-accent); border-color: var(--bmm-accent); }
.bmm-btn--secondary:hover { background: var(--bmm-accent); color: #fff; }
.bmm-btn--outline { background: transparent; color: var(--bmm-text); border-color: var(--bmm-border); }
.bmm-btn--outline:hover { border-color: var(--bmm-accent); color: var(--bmm-accent); }


/* ============================================================
   Lista de deseos – Shortcode
   ============================================================ */

.bmm-wishlist-empty {
    text-align: center;
    padding: 60px 20px;
}

.bmm-wishlist-empty__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 22px;
    color: #ddd;
}

.bmm-wishlist-empty__icon svg { width: 100%; height: 100%; }

.bmm-wishlist-empty h2 { margin: 0 0 10px; font-size: 1.4rem; }
.bmm-wishlist-empty p  { margin: 0 0 24px; color: var(--bmm-text-muted); }

.bmm-wishlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 22px;
    padding: 8px 0 40px;
}

.bmm-wishlist-item {
    border: 1px solid var(--bmm-border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--bmm-bg);
    transition: box-shadow 0.22s ease, transform 0.22s ease;
}

.bmm-wishlist-item:hover {
    box-shadow: 0 6px 26px rgba(0, 0, 0, 0.09);
    transform: translateY(-2px);
}

.bmm-wishlist-item.bmm-removing {
    animation: bmm-item-out 0.36s ease forwards;
    pointer-events: none;
}

@keyframes bmm-item-out {
    to { opacity: 0; transform: scale(0.88); }
}

.bmm-wishlist-item__image {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f6f6f6;
}

.bmm-wishlist-item__image a { display: block; height: 100%; }

.bmm-wishlist-item__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.bmm-wishlist-item:hover .bmm-wishlist-item__image img { transform: scale(1.05); }

.bmm-wishlist-item__info { padding: 14px 16px 16px; }

.bmm-wishlist-item__name {
    margin: 0 0 6px;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
}

.bmm-wishlist-item__name a { color: var(--bmm-text); text-decoration: none; }
.bmm-wishlist-item__name a:hover { color: var(--bmm-accent); }

.bmm-wishlist-item__price { font-size: 1rem; font-weight: 700; color: var(--bmm-accent); margin-bottom: 6px; }
.bmm-wishlist-item__stock { margin-bottom: 12px; font-size: 0.8rem; }

.bmm-in-stock     { color: #27ae60; }
.bmm-out-of-stock { color: #e74c3c; }

.bmm-wishlist-item__actions .bmm-btn { width: 100%; justify-content: center; }


/* ============================================================
   Toast
   ============================================================ */

#bmm-toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: rgba(30, 30, 30, 0.92);
    color: #fff;
    padding: 10px 20px;
    border-radius: 99px;
    font-size: 0.84rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 999997;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease, transform 0.24s ease;
    max-width: calc(100vw - 40px);
    text-align: center;
}

@media (max-width: 767px) {
    #bmm-toast {
        bottom: calc(var(--bmm-height) + env(safe-area-inset-bottom, 0px) + 10px);
    }
}

@media (min-width: 768px) {
    #bmm-toast { bottom: 24px; }
}

#bmm-toast.bmm-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
