/* Floating Contact Buttons - frontend styles */

.fcb-stack {
    position: fixed;
    bottom: calc(var(--fcb-offset, 24px) + env(safe-area-inset-bottom, 0px));
    z-index: var(--fcb-z, 9999);
    display: flex;
    flex-direction: column;
    gap: 14px;
    pointer-events: none; /* let children handle events */
}

.fcb-stack.fcb-pos-right {
    right: calc(18px + env(safe-area-inset-right, 0px));
    align-items: flex-end;
}

.fcb-stack.fcb-pos-left {
    left: calc(18px + env(safe-area-inset-left, 0px));
    align-items: flex-start;
}

/* Base button (pill that expands on hover) */
.fcb-btn {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    height: 56px;
    width: 56px;
    padding: 0;
    border-radius: 999px;
    color: #fff;
    text-decoration: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    line-height: normal;
    overflow: hidden;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.12);
    transition: width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.25s ease,
                transform 0.2s ease,
                background-color 0.25s ease;
    will-change: width, transform;

    /* entrance animation */
    opacity: 0;
    transform: translateY(16px) scale(0.9);
    animation: fcb-enter 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Stagger the entrance a little */
.fcb-btn:nth-child(1) { animation-delay: 0.05s; }
.fcb-btn:nth-child(2) { animation-delay: 0.18s; }

@keyframes fcb-enter {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Icon holder keeps circle centered */
.fcb-icon {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fcb-icon svg {
    display: block;
}

/* Label appears on expand */
.fcb-label {
    display: inline-block;
    opacity: 0;
    max-width: 0;
    padding: 2px 0;
    padding-right: 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.5;
    vertical-align: middle;
    transition: opacity 0.25s ease 0.05s, max-width 0.32s ease, padding-right 0.32s ease;
}

.fcb-pos-left .fcb-btn {
    justify-content: flex-start;
}

/* Hover / focus / touch-open expand — wide enough for email/number */
.fcb-btn:hover,
.fcb-btn:focus-visible,
.fcb-btn.fcb-open {
    width: auto;
    min-width: 56px;
    max-width: min(92vw, 320px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24), 0 4px 10px rgba(0, 0, 0, 0.16);
    transform: translateY(-2px);
}

.fcb-btn:hover .fcb-label,
.fcb-btn:focus-visible .fcb-label,
.fcb-btn.fcb-open .fcb-label {
    opacity: 1;
    max-width: 260px;
    padding-right: 18px;
    overflow-x: hidden;
    overflow-y: visible;
    text-overflow: ellipsis;
}

.fcb-btn:active {
    transform: translateY(0) scale(0.97);
}

/* Accessible focus ring */
.fcb-btn:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.85);
    outline-offset: 2px;
}

/* Brand colors */
.fcb-btn-email {
    background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
}

.fcb-btn-email:hover,
.fcb-btn-email:focus-visible,
.fcb-btn-email.fcb-open {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
}

.fcb-btn-whatsapp {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
}

.fcb-btn-whatsapp:hover,
.fcb-btn-whatsapp:focus-visible,
.fcb-btn-whatsapp.fcb-open {
    background: linear-gradient(135deg, #2ee06f 0%, #0f9d84 100%);
}

/* Subtle pulse ring on WhatsApp to draw attention */
.fcb-btn-whatsapp .fcb-icon {
    position: relative;
}

.fcb-btn-whatsapp .fcb-icon::after {
    content: "";
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 999px;
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.55);
    animation: fcb-pulse 2.4s ease-out infinite;
    pointer-events: none;
}

@keyframes fcb-pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
    70% { box-shadow: 0 0 0 16px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* Mobile: smaller buttons, safe area handled above */
@media (max-width: 600px) {
    .fcb-stack {
        gap: 12px;
    }

    .fcb-stack.fcb-pos-right {
        right: calc(14px + env(safe-area-inset-right, 0px));
    }

    .fcb-stack.fcb-pos-left {
        left: calc(14px + env(safe-area-inset-left, 0px));
    }

    .fcb-btn {
        height: 50px;
        width: 50px;
        font-size: 14px;
    }

    .fcb-icon {
        flex-basis: 50px;
        width: 50px;
        height: 50px;
    }

    .fcb-btn-whatsapp .fcb-icon::after {
        width: 50px;
        height: 50px;
    }

    .fcb-btn:hover,
    .fcb-btn:focus-visible,
    .fcb-btn.fcb-open {
        width: auto;
        min-width: 50px;
        max-width: min(92vw, 280px);
    }

    .fcb-btn:hover .fcb-label,
    .fcb-btn:focus-visible .fcb-label,
    .fcb-btn.fcb-open .fcb-label {
        max-width: 220px;
        font-size: 12px;
    }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .fcb-btn {
        animation: none;
        opacity: 1;
        transform: none;
        transition: width 0.2s ease, background-color 0.2s ease;
    }

    .fcb-btn-whatsapp .fcb-icon::after {
        animation: none;
    }
}
