/**
 * Buy Now Floating Button Styles
 * High-converting, responsive floating CTA with $69 price pill and micro-animations
 */

:root {
    --bn-fallback-primary: #ff5e14;
    --bn-bg-main: var(--theme-color, var(--primary-color, var(--bn-fallback-primary)));
}

.buy-now-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 8px 16px;
    background-color: var(--bn-bg-main);
    background-image: linear-gradient(135deg, var(--bn-bg-main) 0%, color-mix(in srgb, var(--bn-bg-main) 82%, #000000) 100%);
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.28), 0 6px 12px -4px rgba(0, 0, 0, 0.18);
    font-family: inherit;
    font-weight: 600;
    line-height: 1;
    overflow: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;

    /* Base transform identity to avoid stacking context shifts */
    translate: 0 0;
    scale: 1;
    transition: translate 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                scale 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.25s ease,
                filter 0.25s ease;
}

/* RTL Support */
html[dir="rtl"] .buy-now-btn {
    right: auto;
    left: 24px;
    padding: 8px 16px 8px 10px;
}

/* Pulsing backdrop ring */
.buy-now-btn::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 9999px;
    background: inherit;
    opacity: 0.45;
    z-index: -1;
    pointer-events: none;
    animation: buy-now-pulse-anim 2.8s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

@keyframes buy-now-pulse-anim {
    0% {
        transform: scale(0.96);
        opacity: 0.6;
    }
    60% {
        transform: scale(1.12, 1.25);
        opacity: 0;
    }
    100% {
        transform: scale(0.96);
        opacity: 0;
    }
}

/* Shimmer shine effect */
.buy-now-shine {
    position: absolute;
    top: -50%;
    left: -120%;
    width: 60%;
    height: 200%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.32), transparent);
    transform: rotate(25deg);
    pointer-events: none;
    animation: buy-now-shine-anim 5.5s ease-in-out infinite;
}

@keyframes buy-now-shine-anim {
    0%, 75% {
        left: -120%;
    }
    100% {
        left: 220%;
    }
}

/* Cart Icon Wrapper */
.buy-now-icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.buy-now-icon {
    display: block;
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2.2;
}

/* Action Label ("Buy Now") */
.buy-now-label {
    display: inline-block;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Distinct Price Badge ($69) */
.buy-now-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    background: #ffffff;
    color: #0f172a;
    padding: 5px 11px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.25s ease,
                background-color 0.25s ease;
}

.buy-now-currency {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    opacity: 0.8;
    margin-right: 1px;
}

.buy-now-price {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
}

/* Hover and Focus States */
.buy-now-btn:hover {
    translate: 0 -3px;
    scale: 1.03;
    color: #ffffff !important;
    text-decoration: none !important;
    filter: brightness(1.05);
    box-shadow: 0 16px 32px -4px rgba(0, 0, 0, 0.35), 0 8px 16px -4px rgba(0, 0, 0, 0.22);
}

.buy-now-btn:hover .buy-now-icon-box {
    transform: scale(1.14) rotate(-8deg);
    background: rgba(255, 255, 255, 0.25);
}

.buy-now-btn:hover .buy-now-badge {
    transform: scale(1.06);
    background: #f8fafc;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Active / Pressed State */
.buy-now-btn:active {
    translate: 0 0;
    scale: 0.98;
    filter: brightness(0.97);
    box-shadow: 0 6px 14px -3px rgba(0, 0, 0, 0.28);
}

.buy-now-btn:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.7);
    outline-offset: 3px;
}

/* Responsive for Tablets and Mobile */
@media (max-width: 768px) {
    .buy-now-btn {
        bottom: 16px;
        right: 16px;
        padding: 7px 8px 7px 14px;
        gap: 8px;
    }

    html[dir="rtl"] .buy-now-btn {
        right: auto;
        left: 16px;
        padding: 7px 14px 7px 8px;
    }

    .buy-now-label {
        font-size: 14px;
    }

    .buy-now-badge {
        padding: 4px 9px;
        font-size: 13px;
    }

    .buy-now-price {
        font-size: 14px;
    }

    .buy-now-icon-box {
        width: 24px;
        height: 24px;
    }

    .buy-now-icon {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    .buy-now-btn {
        bottom: 12px;
        right: 12px;
        padding: 6px 7px 6px 12px;
        gap: 6px;
    }

    html[dir="rtl"] .buy-now-btn {
        right: auto;
        left: 12px;
        padding: 6px 12px 6px 7px;
    }

    .buy-now-label {
        font-size: 13px;
    }

    .buy-now-badge {
        padding: 3px 8px;
    }
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .buy-now-btn,
    .buy-now-btn::before,
    .buy-now-shine,
    .buy-now-icon-box,
    .buy-now-badge {
        animation: none !important;
        transition: none !important;
    }
}

/* Hide on Print */
@media print {
    .buy-now-btn {
        display: none !important;
    }
}
