/**
 * FloatingCTA.js - Lightweight floating CTA widget with Bulma
 * Version: 2.1.0
 * Size: ~1KB (relies on Bulma for base styling)
 */

/* Floating Button */
.floating-cta-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #4169E1;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    color: white;
    font-size: 24px;
}

.floating-cta-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.floating-cta-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* Position variants */
.floating-cta-button.bottom-left {
    right: auto;
    left: 20px;
}

.floating-cta-button.top-right {
    bottom: auto;
    top: 20px;
}

.floating-cta-button.top-left {
    bottom: auto;
    top: 20px;
    right: auto;
    left: 20px;
}

/* Popup Container */
.floating-cta-popup {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: 420px;
    max-width: calc(100vw - 40px);
    z-index: 9999;
    opacity: 0;
    transform: scale(0.9) translateY(10px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.floating-cta-popup.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* Position variants for popup */
.floating-cta-popup.bottom-left {
    right: auto;
    left: 20px;
}

.floating-cta-popup.top-right {
    bottom: auto;
    top: 100px;
}

.floating-cta-popup.top-left {
    bottom: auto;
    top: 100px;
    right: auto;
    left: 20px;
}

/* Popup box styling */
.floating-cta-popup .box {
    background: #f4efee;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 0;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

/* Header */
.floating-cta-header {
    padding: 2rem 2rem 1.5rem;
    position: relative;
}

.floating-cta-header .title {
    margin-bottom: 0;
    padding-right: 40px;
}

.floating-cta-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    color: #666;
    font-size: 20px;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.floating-cta-close:hover {
    background: #f0f0f0;
}

/* Content */
.floating-cta-content {
    padding: 0 2rem 2rem;
}

/* Description can contain HTML */
.floating-cta-description {
    margin-bottom: 1.5rem;
}

.floating-cta-description p {
    margin-bottom: 0.75rem;
}

.floating-cta-description p:last-child {
    margin-bottom: 0;
}

/* Contact items using Bulma's level */
.floating-cta-contact .level-item {
    justify-content: flex-start;
}

.floating-cta-contact a {
    color: #363636;
    transition: color 0.2s ease;
}

.floating-cta-contact a:hover {
    color: #4169E1;
}

.floating-cta-contact .icon {
    width: 20px;
    height: 20px;
}

.floating-cta-contact .icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .floating-cta-popup {
        width: auto;
        bottom: 0px;
        right: 20px;
        left: 20px;
    }

    .floating-cta-popup .box {
        max-height: calc(100vh - 120px);
    }

    .floating-cta-header {
        padding: 1rem 1rem 0.5rem;
    }

    .floating-cta-content {
        padding: 0 1rem 1rem;
    }

    .floating-cta-description {
        margin-bottom: 0.8rem !important;
    }
    .floating-cta-description p {
        font-size: 0.9rem;
    }
    .floating-cta-contact a {
        font-size: 0.9rem;
    }

    .floating-cta-button {
        width: 56px;
        height: 56px;
        bottom: 10px;
        right: 10px;
    }

    .floating-cta-button svg {
        width: 24px;
        height: 24px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .floating-cta-button,
    .floating-cta-popup,
    .floating-cta-close {
        transition: none;
    }
}

/* Focus styles for accessibility */
.floating-cta-button:focus,
.floating-cta-close:focus {
    outline: 2px solid #4169E1;
    outline-offset: 2px;
}

/* Bulma button override for outlined style */
.floating-cta-popup .button.is-outlined {
    background-color: transparent;
}

.floating-cta-popup .button.is-outlined:hover {
    background-color: #4169E1;
    border-color: #4169E1;
    color: white;
}