/* ============================================
   Floating Contact FAB Group
   Mobile-only expandable floating action button
   ============================================ */

/* Container — mobile only, hidden on desktop */
.floating-contact {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 16px;
    z-index: 9999;
    flex-direction: column-reverse;
    align-items: center;
    gap: 0;
    pointer-events: none;
}

@media (max-width: 767px) {
    .floating-contact {
        display: flex;
    }
}

/* ---- Main FAB Button ---- */
.fab-main {
    pointer-events: auto;
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F472B6, #EC4899, #DB2777);
    color: #fff;
    box-shadow:
        0 4px 14px rgba(236, 72, 153, 0.45),
        0 1px 3px rgba(0, 0, 0, 0.12);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.fab-main:active {
    transform: scale(0.92);
}

.fab-main:focus-visible {
    box-shadow:
        0 4px 14px rgba(236, 72, 153, 0.45),
        0 0 0 3px rgba(236, 72, 153, 0.35);
}

/* Rotating icon inside main button */
.fab-main .fab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-contact.is-expanded .fab-main .fab-icon {
    transform: rotate(45deg);
}

/* Pulse ring animation on main button */
.fab-main::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: rgba(236, 72, 153, 0.25);
    animation: fab-pulse 2s ease-in-out infinite;
    pointer-events: none;
}

.floating-contact.is-expanded .fab-main::before {
    animation: none;
    opacity: 0;
}

@keyframes fab-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.25);
        opacity: 0;
    }
}

/* ---- FAB Group (child buttons container) ---- */
.fab-group {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    pointer-events: none;
}

/* ---- Individual FAB Items ---- */
.fab-item {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    text-decoration: none;
    background: #fff;
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.12),
        0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s ease,
                box-shadow 0.25s ease;
    /* Initial hidden state */
    opacity: 0;
    transform: scale(0.3) translateY(20px);
    pointer-events: none;
    will-change: transform, opacity;
}

.fab-item:active {
    transform: scale(0.92) translateY(0) !important;
}

.fab-item:focus-visible {
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.12),
        0 0 0 3px rgba(236, 72, 153, 0.35);
}

.fab-item img,
.fab-item i {
    width: 26px;
    height: 26px;
    object-fit: contain;
    pointer-events: none;
}

.fab-item i {
    font-size: 22px;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Expanded State ---- */
.floating-contact.is-expanded .fab-group {
    pointer-events: auto;
}

.floating-contact.is-expanded .fab-item {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Stagger delays for expansion (bottom-to-top reveal) */
.floating-contact.is-expanded .fab-item:nth-child(1) {
    transition-delay: 0ms;
}
.floating-contact.is-expanded .fab-item:nth-child(2) {
    transition-delay: 60ms;
}
.floating-contact.is-expanded .fab-item:nth-child(3) {
    transition-delay: 120ms;
}

/* Stagger delays for collapse (top-to-bottom hide) */
.floating-contact:not(.is-expanded) .fab-item:nth-child(3) {
    transition-delay: 0ms;
}
.floating-contact:not(.is-expanded) .fab-item:nth-child(2) {
    transition-delay: 60ms;
}
.floating-contact:not(.is-expanded) .fab-item:nth-child(1) {
    transition-delay: 120ms;
}

/* ---- Individual Button Colors ---- */
.fab-item.hotline {
    background: linear-gradient(135deg, #10B981, #059669);
    color: #fff;
}

.fab-item.hotline i {
    color: #fff;
}

.fab-item.zalo {
    background: #fff;
}

.fab-item.messenger {
    background: #fff;
}

/* ---- Hover Effects (touch devices won't trigger) ---- */
@media (hover: hover) {
    .fab-main:hover {
        transform: scale(1.08);
        box-shadow:
            0 6px 20px rgba(236, 72, 153, 0.5),
            0 2px 6px rgba(0, 0, 0, 0.12);
    }

    .fab-item:hover {
        transform: scale(1.12) translateY(0) !important;
        box-shadow:
            0 4px 16px rgba(0, 0, 0, 0.18),
            0 2px 4px rgba(0, 0, 0, 0.1);
    }
}

/* ---- Tooltip Labels (optional enhancement) ---- */
.fab-item::before {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(26, 32, 44, 0.9);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.floating-contact.is-expanded .fab-item:hover::before {
    opacity: 1;
}

/* ---- Backdrop overlay (subtle) ---- */
.fab-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.08);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.fab-backdrop.is-visible {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    .fab-main,
    .fab-main .fab-icon,
    .fab-main::before,
    .fab-item,
    .fab-backdrop {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
