/**
 * Ficha de producto: barra de compra fija en móvil, "Comprar ahora" y contador de la galería (inc/sticky-buy.php).
 * Se carga después de style.css (inc/assets.php).
 */

.allimport-buy-now-btn {
    width: 100% !important;
    order: -1 !important;
    height: 46px !important;
    background: #2563eb !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28) !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.allimport-buy-now-btn:hover {
    background: #1d4ed8 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.38) !important;
}

.allimport-buy-now-btn svg {
    width: 17px !important;
    height: 17px !important;
    fill: currentColor !important;
}

@media (min-width: 769px) {
/* El contador de fotos es solo para el celular (ahí va sobre la foto); en pantallas grandes se ven las miniaturas */
.allimport-gallery-counter {
        display: none !important;
    }
.buybox-cart-form-wrap form.cart div.quantity .allimport-qty-btn {
        width: 36px !important;
        height: 100% !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        color: #475569 !important;
        font-size: 20px !important;
        font-weight: 800 !important;
        line-height: 1 !important;
        box-shadow: none !important;
        cursor: pointer !important;
        transition: background-color 0.15s ease, color 0.15s ease !important;
    }
.buybox-cart-form-wrap form.cart div.quantity .allimport-qty-btn:hover,
    .buybox-cart-form-wrap form.cart div.quantity .allimport-qty-btn:focus-visible {
        background: #e2e8f0 !important;
        color: #0f172a !important;
        box-shadow: none !important;
        transform: none !important;
    }
}

@media (max-width: 768px) {
.allimport-gallery-counter {
        position: absolute !important;
        bottom: 64px !important;
        right: 12px !important;
        background: rgba(15, 23, 42, 0.72) !important;
        color: #ffffff !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        padding: 3px 9px !important;
        border-radius: 999px !important;
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        z-index: 10 !important;
        pointer-events: none !important;
        letter-spacing: 0.3px !important;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06) !important;
    }
}

@media (max-width: 768px) {
.buybox-cart-form-wrap form.cart div.quantity .allimport-qty-btn {
        width: 32px !important;
        height: 100% !important;
        border: none !important;
        background: transparent !important;
        color: #475569 !important;
        font-size: 18px !important;
        font-weight: 800 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        padding: 0 !important;
        transition: background 0.15s ease !important;
    }
.buybox-cart-form-wrap form.cart div.quantity .allimport-qty-btn:active {
        background: #e2e8f0 !important;
        color: #0f172a !important;
    }
}

.allimport-sticky-buy-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 998 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-top: 1px solid #e2e8f0 !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12) !important;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)) 14px !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease !important;
    display: none !important;
}

@media (max-width: 768px) {
.allimport-sticky-buy-bar {
        display: block !important;
    }
}

.allimport-sticky-buy-bar.is-hidden {
    transform: translateY(115%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.allimport-sticky-buy-bar.is-visible {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.sticky-bar-inner {
    width: 100% !important;
    max-width: 720px !important;
    margin: 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
}

.sticky-product-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
}

.sticky-quantity {
    display: inline-flex !important;
    align-items: center !important;
    height: 48px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px !important;
    background: #f8fafc !important;
    overflow: hidden !important;
    width: 100% !important;
    justify-content: center !important;
}

.sticky-qty-btn {
    width: 36px !important;
    height: 100% !important;
    border: 0 !important;
    background: transparent !important;
    color: #334155 !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    padding: 0 !important;
}

.sticky-qty-input {
    width: 42px !important;
    height: 100% !important;
    border: 0 !important;
    background: transparent !important;
    color: #0f172a !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    text-align: center !important;
    padding: 0 !important;
    -moz-appearance: textfield !important;
}

.sticky-qty-input::-webkit-outer-spin-button,
.sticky-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

.sticky-btn-buy {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    background: #2563eb !important;
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    padding: 9px 14px !important;
    border-radius: 12px !important;
    text-decoration: none !important;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3) !important;
    transition: all 0.2s ease !important;
}

.sticky-btn-buy:active {
    transform: scale(0.96) !important;
}

.sticky-badge-out {
    display: inline-block !important;
    background: #f1f5f9 !important;
    color: #64748b !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    border: 1px solid #cbd5e1 !important;
    text-transform: uppercase !important;
}

.sticky-btn-wa {
    width: 38px !important;
    height: 38px !important;
    border-radius: 12px !important;
    background: #25d366 !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    flex-shrink: 0 !important;
}

/* La barra móvil se reserva para cantidad y carrito. */
.allimport-sticky-buy-bar .sticky-btn-wa {
    display: none !important;
}

.allimport-sticky-buy-bar .sticky-btn-buy {
    width: 100% !important;
    min-height: 48px !important;
    padding: 10px 18px !important;
    font-size: 14px !important;
    white-space: nowrap !important;
}

@media (max-width: 768px) {
body .allimport-gallery-counter {
        font-size: 12px !important;
    }
}
