/**
 * Sticky CTA Styles
 * 
 * Provides styling for the sticky footer CTA on product pages.
 * Includes responsive design, safe area support, and accessibility features.
 */

/* Base sticky CTA container */
#fp-sticky-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #E5E7EB;
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1000;
    /* Ensure it's above page content but below cookie/consent bars */
}

/* Visible state */
#fp-sticky-cta.is-visible {
    transform: translateY(0);
    opacity: 1;
}

/* Hidden state (initial) */
#fp-sticky-cta.hidden {
    display: none;
}

/* Inner container with max-width matching theme */
.fp-sticky-cta__inner {
    max-width: 1200px;
    /* Match theme container */
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 48px;
}

/* Price section */
.fp-sticky-cta__price {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.fp-sticky-cta__sale {
    font-family: "Fredoka", sans-serif;
    font-weight: 700;
    font-size: 24px;
    line-height: 28px;
    color: #1F2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fp-sticky-cta__compare {
    font-family: "Fredoka", sans-serif;
    font-weight: 500;
    font-size: 18px;
    line-height: 22px;
    color: #9CA3AF;
    white-space: nowrap;
    text-decoration: line-through;
}

/* Actions section */
.fp-sticky-cta__actions {
    flex-shrink: 0;
}

/* Button styling - modern design */
#fp-sticky-cta-btn {
    min-width: 140px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    line-height: 20px;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    cursor: pointer;
}

/* Button states */
#fp-sticky-cta-btn[data-state="select"] {
    background-color: #fff;
    color: #3651D9;
    border: 2px solid #3651D9;
}

#fp-sticky-cta-btn[data-state="select"]:hover {
    background-color: #3651D9;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(54, 81, 217, 0.3);
}

#fp-sticky-cta-btn[data-state="add"] {
    background-color: #3651D9;
    color: #fff;
    border: 2px solid #3651D9;
}

#fp-sticky-cta-btn[data-state="add"]:hover {
    background-color: #142ACC;
    border-color: #142ACC;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(54, 81, 217, 0.3);
}

#fp-sticky-cta-btn[data-state="disabled"] {
    background-color: #F3F4F6;
    color: #9CA3AF;
    border: 2px solid #E5E7EB;
    cursor: not-allowed;
}

#fp-sticky-cta-btn[data-state="disabled"]:hover {
    background-color: #F3F4F6;
    color: #9CA3AF;
    border-color: #E5E7EB;
    transform: none;
    box-shadow: none;
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .fp-sticky-cta__inner {
        gap: 16px;
    }

    .fp-sticky-cta__sale {
        font-size: 20px;
        line-height: 24px;
    }

    .fp-sticky-cta__compare {
        font-size: 16px;
        line-height: 20px;
    }

    #fp-sticky-cta-btn {
        min-width: 120px;
        padding: 12px 20px;
        font-size: 15px;
    }

    #fp-sticky-cta {
        padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    }
}

/* Tablet optimizations */
@media (min-width: 641px) and (max-width: 1024px) {
    .fp-sticky-cta__inner {
        gap: 16px;
    }

    .fp-sticky-cta__sale {
        font-size: 20px;
        line-height: 24px;
    }

    #fp-sticky-cta-btn {
        min-width: 140px;
        padding: 14px 20px;
    }
}

/* Desktop optimizations */
@media (min-width: 1025px) {
    .fp-sticky-cta__inner {
        gap: 20px;
    }

    .fp-sticky-cta__sale {
        font-size: 24px;
        line-height: 28px;
    }

    .fp-sticky-cta__compare {
        font-size: 18px;
        line-height: 22px;
    }

    #fp-sticky-cta-btn {
        min-width: 160px;
        padding: 16px 24px;
        font-size: 18px;
        line-height: 24px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #fp-sticky-cta {
        border-top: 2px solid #000;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
    }

    .fp-sticky-cta__sale {
        color: #000;
    }

    .fp-sticky-cta__compare {
        color: #666;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    #fp-sticky-cta {
        transition: none;
    }

    #fp-sticky-cta-btn {
        transition: none;
    }
}

/* Focus styles for accessibility */
#fp-sticky-cta-btn:focus {
    outline: 2px solid #3651D9;
    outline-offset: 2px;
}

/* Screen reader only text */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* Ensure CTA doesn't interfere with other fixed elements */
body.has-sticky-cta {
    padding-bottom: 0;
    /* Let the CTA handle its own spacing */
}

/* Chat widget compatibility - ensure CTA doesn't overlap */
#fp-sticky-cta {
    /* Adjust z-index if chat widgets are present */
    z-index: 1000;
}

/* Cookie bar compatibility */
.cky-consent-bar~#fp-sticky-cta {
    bottom: 60px;
    /* Adjust based on cookie bar height */
}

/* Theme-specific adjustments - removed to prevent header issues */

/* Ensure sticky CTA doesn't interfere with existing fixed elements */
.site-header {
    z-index: 1001;
    /* Above sticky CTA */
}

/* Mobile menu compatibility */
#mobile-dropdown {
    z-index: 1002;
    /* Above sticky CTA */
}

/* Loading state */
#fp-sticky-cta-btn.loading {
    position: relative;
    color: transparent;
}

#fp-sticky-cta-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: fp-spin 1s linear infinite;
}

@keyframes fp-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}