/* MAX CTA Booster – Khaled */

/* Root brand variables */
:root {
    --max-cta-primary: #000000;
    --max-cta-accent: #ffe600;
    --max-cta-text: #ffffff;
    --max-cta-bottom-offset: 0px;
}

/* Sticky wrapper around the main Add to Cart button */
.max-cta-booster-wrap {
    position: sticky;
    bottom: var(--max-cta-bottom-offset, 0px);
    z-index: 40;
    padding: 8px 16px 16px;
    display: flex;
    justify-content: center;
    pointer-events: none; /* Only button is clickable */
}

/* On small screens, cap the width */
@media (max-width: 768px) {
    .max-cta-booster-wrap {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* Main CTA button styles */
button.single_add_to_cart_button.max-cta-btn {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    /* Capsule */
    border-radius: 9999px;
    border: none;

    /* Background + depth */
    background: linear-gradient(145deg, var(--max-cta-primary), #222222);
    color: var(--max-cta-text);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.03em;
    text-transform: none;
    text-align: center;

    padding: 14px 28px;
    max-width: 320px;
    width: 100%;

    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.45),
        0 0 0 0 rgba(255, 230, 0, 0.65);

    position: relative;
    overflow: visible;

    transform: translateZ(0);
    transition:
        transform 0.18s ease-out,
        box-shadow 0.18s ease-out,
        background 0.2s ease-out;
}

/* Inner label span */
.max-cta-label {
    position: relative;
    z-index: 2;
    white-space: nowrap;
}

/* Optional icon, editable from CSS only */
button.single_add_to_cart_button.max-cta-btn.max-cta-icon-on .max-cta-label::before {
    content: "⚡"; /* Change here to 🛒 or any icon you like */
    display: inline-block;
    margin-right: 0.55em;
    font-size: 1.1em;
    transform: translateY(0.03em);
}

/* Glow ring layer */
button.single_add_to_cart_button.max-cta-btn::after {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 9999px;
    border: 2px solid rgba(255, 230, 0, 0.85);
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

/* Hover/press states (desktop primarily) */
button.single_add_to_cart_button.max-cta-btn:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.55),
        0 0 0 4px rgba(255, 230, 0, 0.35);
}

button.single_add_to_cart_button.max-cta-btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.6),
        0 0 0 0 rgba(255, 230, 0, 0.0);
}

/* Pulse state – controlled by JS via wrapper */
.max-cta-booster-wrap.max-cta-is-pulsing button.single_add_to_cart_button.max-cta-btn {
    animation: max-cta-pulse 1.35s ease-out infinite;
}

.max-cta-booster-wrap.max-cta-is-pulsing button.single_add_to_cart_button.max-cta-btn::after {
    animation: max-cta-ring 1.35s ease-out infinite;
}

/* Entrance bounce */
.max-cta-booster-wrap.max-cta-enter button.single_add_to_cart_button.max-cta-btn {
    animation: max-cta-bounce-in 0.8s cubic-bezier(0.22, 0.9, 0.36, 1.0) 1;
}

/* Pulse keyframes: inner 3D + subtle outer pulse */
@keyframes max-cta-pulse {
    0% {
        transform: translateY(0) scale(1);
        box-shadow:
            0 8px 20px rgba(0, 0, 0, 0.48),
            0 0 0 0 rgba(255, 230, 0, 0.7);
    }
    60% {
        transform: translateY(-1px) scale(1.02);
        box-shadow:
            0 10px 24px rgba(0, 0, 0, 0.55),
            0 0 0 10px rgba(255, 230, 0, 0.0);
    }
    100% {
        transform: translateY(0) scale(1);
        box-shadow:
            0 8px 20px rgba(0, 0, 0, 0.48),
            0 0 0 0 rgba(255, 230, 0, 0.0);
    }
}

/* Outer glow ring pulse */
@keyframes max-cta-ring {
    0% {
        opacity: 0.9;
        transform: scale(0.9);
    }
    60% {
        opacity: 0;
        transform: scale(1.12);
    }
    100% {
        opacity: 0;
        transform: scale(1.12);
    }
}

/* Entrance bounce keyframes when CTA first enters viewport */
@keyframes max-cta-bounce-in {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    55% {
        opacity: 1;
        transform: translateY(-6px) scale(1.04);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Error shake for WooCommerce notice block */
.max-cta-error-shake {
    animation: max-cta-error-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) 1;
}

@keyframes max-cta-error-shake {
    0% {
        transform: translateX(0);
    }
    20% {
        transform: translateX(-6px);
    }
    40% {
        transform: translateX(6px);
    }
    60% {
        transform: translateX(-4px);
    }
    80% {
        transform: translateX(4px);
    }
    100% {
        transform: translateX(0);
    }
}

/* Defensive: ensure CTA colors override unwanted inherited styles */
button.single_add_to_cart_button.max-cta-btn,
button.single_add_to_cart_button.max-cta-btn:visited {
    color: var(--max-cta-text);
}

/* Minor tightening on desktop (width) */
@media (min-width: 769px) {
    button.single_add_to_cart_button.max-cta-btn {
        max-width: 340px;
    }
}
