﻿/* =========================================================
   FLOATING CONTACT
   Nút liên hệ nhanh cố định bên phải màn hình
   - Điện thoại
   - Messenger
   - Zalo
========================================================= */

.floating-contact {
    position: fixed;
    top: 58%;
    right: max(14px, calc((100vw - 1280px) / 2 + 14px));
    z-index: 900;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    transform: translateY(-50%);
    pointer-events: none;
}


/* =========================================================
   TỪNG NÚT
========================================================= */

.floating-contact__item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    color: #ffffff;
    text-decoration: none;
    pointer-events: auto;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}


/* =========================================================
   HÌNH TRÒN CHỨA ICON
========================================================= */

.floating-contact__button {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22), 0 1px 4px rgba(0, 0, 0, 0.16);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}


    /* =========================================================
   ICON
========================================================= */

    .floating-contact__button i {
        display: block;
        font-size: 26px;
        line-height: 1;
    }


/* =========================================================
   HOVER / FOCUS
========================================================= */

.floating-contact__item:hover,
.floating-contact__item:focus,
.floating-contact__item:active {
    color: #ffffff;
    text-decoration: none;
}

    .floating-contact__item:hover .floating-contact__button,
    .floating-contact__item:focus-visible .floating-contact__button {
        transform: scale(1.08);
        box-shadow: 0 7px 18px rgba(0, 0, 0, 0.28), 0 2px 6px rgba(0, 0, 0, 0.18);
    }

.floating-contact__item:focus-visible .floating-contact__button {
    outline: 3px solid rgba(255, 255, 255, 0.9);
    outline-offset: 3px;
}


/* =========================================================
   NHÃN HIỆN BÊN TRÁI KHI HOVER TRÊN DESKTOP
========================================================= */

.floating-contact__label {
    position: absolute;
    right: 47px;
    z-index: 1;
    min-width: max-content;
    padding: 8px 18px 8px 12px;
    visibility: hidden;
    opacity: 0;
    color: #ffffff;
    background: rgba(55, 55, 55, 0.94);
    border-radius: 18px 0 0 18px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    transform: translateX(8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.floating-contact__item:hover .floating-contact__label,
.floating-contact__item:focus-visible .floating-contact__label {
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
}


/* =========================================================
   PHONE
========================================================= */

.floating-contact__item--phone .floating-contact__button {
    background: #f4b400;
}


    /*
   Vòng sóng nhẹ quanh nút điện thoại.
   Không dùng animation quá mạnh để tránh gây khó chịu.
*/
    .floating-contact__item--phone .floating-contact__button::before,
    .floating-contact__item--phone .floating-contact__button::after {
        content: "";
        position: absolute;
        inset: -5px;
        border: 2px solid rgba(244, 180, 0, 0.55);
        border-radius: 50%;
        pointer-events: none;
        animation: floatingPhonePulse 2s ease-out infinite;
    }

    .floating-contact__item--phone .floating-contact__button::after {
        animation-delay: 1s;
    }


/* =========================================================
   MESSENGER
========================================================= */

.floating-contact__item--messenger .floating-contact__button {
    background: #0866ff;
}


/* =========================================================
   ZALO
========================================================= */

.floating-contact__item--zalo .floating-contact__button {
    background: #0068ff;
}


/*
   Không cần tải thêm thư viện icon riêng cho Zalo.
   Chữ Zalo được dựng trực tiếp trong nút.
*/
.floating-contact__zalo-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 25px;
    background: #ffffff;
    color: #0068ff;
    border-radius: 13px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.3px;
}


/* =========================================================
   PHONE PULSE
========================================================= */

@keyframes floatingPhonePulse {
    0% {
        opacity: 0.7;
        transform: scale(0.9);
    }

    70% {
        opacity: 0;
        transform: scale(1.28);
    }

    100% {
        opacity: 0;
        transform: scale(1.28);
    }
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 991.98px) {

    .floating-contact {
        right: 12px;
        gap: 11px;
    }

    .floating-contact__button {
        width: 54px;
        height: 54px;
        flex-basis: 54px;
    }

        .floating-contact__button i {
            font-size: 25px;
        }
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 767.98px) {

    .floating-contact {
        top: 60%;
        right: 9px;
        gap: 10px;
        transform: translateY(-50%);
    }

    .floating-contact__button {
        width: 50px;
        height: 50px;
        flex-basis: 50px;
        border-width: 2px;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22), 0 1px 3px rgba(0, 0, 0, 0.14);
    }

        .floating-contact__button i {
            font-size: 23px;
        }

    .floating-contact__zalo-mark {
        width: 34px;
        height: 23px;
        font-size: 10px;
    }

    /*
       Mobile không hiện label.
       Chỉ giữ icon tròn giống mẫu mày gửi,
       tránh che nội dung sản phẩm/bài viết.
    */
    .floating-contact__label {
        display: none;
    }
}


/* =========================================================
   MOBILE RẤT NHỎ
========================================================= */

@media (max-width: 380px) {

    .floating-contact {
        right: 7px;
        gap: 8px;
    }

    .floating-contact__button {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
    }

        .floating-contact__button i {
            font-size: 21px;
        }

    .floating-contact__zalo-mark {
        width: 31px;
        height: 21px;
        font-size: 9px;
    }
}


/* =========================================================
   ACCESSIBILITY
   Nếu người dùng tắt animation trong hệ điều hành
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .floating-contact__button,
    .floating-contact__label {
        transition: none;
    }

    .floating-contact__item--phone .floating-contact__button::before,
    .floating-contact__item--phone .floating-contact__button::after {
        animation: none;
        display: none;
    }
}
