/* ================================
   FLOATING CONTACT - CINVICO Style
   Professional design matching page theme
   ================================ */

.floating-contact {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Base Button Style */
.fc-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    text-decoration: none;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    overflow: visible;
}

.fc-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.fc-btn:focus {
    outline: none;
}

/* Icon */
.fc-btn__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    z-index: 2;
}

.fc-btn__icon svg {
    width: 28px;
    height: 28px;
}

/* Label - Hidden by default, show on hover */
.fc-btn__label {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.fc-btn__label::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #333;
}

.fc-btn:hover .fc-btn__label {
    opacity: 1;
    visibility: visible;
    right: 65px;
}

/* Pulse Animation for Hotline */
.fc-btn__pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    opacity: 0;
    z-index: 0;
    animation: pulse-ring 2s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
}

.fc-btn__pulse:nth-child(2) {
    animation-delay: 0.5s;
}

.fc-btn__pulse:nth-child(3) {
    animation-delay: 1s;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* Hotline - Red with pulse and periodic ring */
.fc-btn--hotline {
    background: linear-gradient(135deg, #e53935, #c62828);
    will-change: transform;
    animation: hotline-ring 3.5s ease-in-out infinite;
}

.fc-btn--hotline .fc-btn__pulse {
    background: #e53935;
}

/*
 * Periodic ring: motion trong 25% đầu (~0.875s), nghỉ 75% còn lại (~2.625s).
 * Rotation tạo cảm giác điện thoại rung thật hơn translateX.
 * Damping dần về 0 như vật lý thực.
 */
@keyframes hotline-ring {
    0%   { transform: rotate(0deg)   scale(1);    }
    4%   { transform: rotate(-14deg) scale(1.06); }
    8%   { transform: rotate(13deg)  scale(1.06); }
    12%  { transform: rotate(-10deg) scale(1.03); }
    16%  { transform: rotate(7deg)   scale(1.01); }
    20%  { transform: rotate(-3deg)  scale(1);    }
    24%  { transform: rotate(0deg)   scale(1);    }
    100% { transform: rotate(0deg)   scale(1);    }
}

.fc-btn--hotline:hover {
    animation: none;
    transform: scale(1.1);
}

/* Tắt animation cho người dùng ưu tiên ít chuyển động */
@media (prefers-reduced-motion: reduce) {
    .fc-btn--hotline {
        animation: none;
    }
    .fc-btn__pulse {
        animation: none;
    }
    .fc-btn--zalo .fc-btn__pulse {
        animation: none;
    }
}

/* Zalo - Blue */
.fc-btn--zalo {
    background: linear-gradient(135deg, #0068ff, #0052cc);
}

.fc-btn--zalo .fc-btn__pulse {
    background: #0068ff;
    animation-duration: 3s;       /* Chậm hơn hotline (2s) */
    animation-delay: 0s;
    opacity: 0;
}

.fc-btn--zalo .fc-btn__pulse:nth-child(2) {
    animation-delay: 1s;          /* Giãn cách hơn hotline (0.5s) */
}

@keyframes pulse-ring-zalo {
    0%   { transform: scale(1);   opacity: 0.4; }
    100% { transform: scale(1.6); opacity: 0;   } /* Nhỏ hơn hotline (1.8) */
}

.fc-btn--zalo .fc-btn__pulse {
    animation-name: pulse-ring-zalo;
    animation-timing-function: cubic-bezier(0.455, 0.03, 0.515, 0.955);
    animation-iteration-count: infinite;
}


/* Messenger - Gradient */
.fc-btn--messenger {
    background: linear-gradient(135deg, #00b2ff, #006aff);
}

/* Facebook - Blue */
.fc-btn--facebook {
    background: linear-gradient(135deg, #1877f2, #0d65d9);
}

/* WhatsApp - Green */
.fc-btn--whatsapp {
    background: linear-gradient(135deg, #25d366, #128c7e);
}

/* Go to Top - Matches page theme */
.fc-btn--totop {
    background: linear-gradient(135deg, #1a4fa0, #0d3a7d);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.fc-btn--totop.fc-btn--visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fc-btn--totop:hover {
    background: linear-gradient(135deg, #0d3a7d, #092d5e);
}

/* ================================
   RESPONSIVE
   ================================ */

@media (max-width: 767.98px) {
    .floating-contact {
        right: 12px;
        bottom: 12px;
        gap: 8px;
    }

    .fc-btn {
        width: 40px;
        height: 40px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    }

    .fc-btn__icon {
        font-size: 1rem;
    }

    .fc-btn__icon svg {
        width: 20px;
        height: 20px;
    }

    .fc-btn__label {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .floating-contact {
        right: 10px;
        bottom: 10px;
        gap: 6px;
    }

    .fc-btn {
        width: 36px;
        height: 36px;
    }

    .fc-btn__icon {
        font-size: 0.875rem;
    }

    .fc-btn__icon svg {
        width: 18px;
        height: 18px;
    }
}
