/* ============================================================
   FAB — Floating Action Button
   Replace the existing FAB block in cms.css (line 370 to end)
   with this entire file.
   ============================================================ */

/* ----------------------------------------------------------
   CONTAINER
   fixed bottom-4 right-2.5 z-[101] | lg:right-5
   ---------------------------------------------------------- */
#fab-container {
    position: fixed;
    bottom: 4rem;
    right: 0.625rem;
    z-index: 101;
    /* Added Flexbox to strictly align elements to the right edge */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

@media (min-width: 1024px) {
    #fab-container {
        right: 1.25rem;
    }
}

/* ----------------------------------------------------------
   MENU LIST
   flex flex-col items-end gap-3 mb-3
   Hidden by default; JS adds .open to show it.
   ---------------------------------------------------------- */
#fab-menu {
    display: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

#fab-menu.open {
    display: flex;
}

/* ----------------------------------------------------------
   MENU BUTTONS  (.btn)
   w-12 h-12 flex items-center justify-center rounded-full
   bg-white border-2 border-white/60 shadow transition duration-300
   ---------------------------------------------------------- */
#fab-menu .btn {
    /* Layout */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    /* Visual */
    border-radius: 9999px;
    background-color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 14.3px rgba(0, 0, 0, 0.27);
    transition: all 0.3s;
    cursor: pointer;
    text-decoration: none;
    /* Animation initial state */
    opacity: 0;
    pointer-events: none;
}

/* Zalo: bg-[#0068FF] */
#fab-menu .btn.btn-zalo {
    background-color: #0068FF;
}

/* Menu icons: w-7 h-7 object-contain */
#fab-menu .fab-icon {
    width: 1.75rem;
    height: 1.75rem;
    object-fit: contain;
}

/* Animation starting transforms */
#fab-menu .btn:nth-child(1) {
    transform: translateY(190px);
}

#fab-menu .btn:nth-child(2) {
    transform: translateY(30px);
}

#fab-menu .btn:nth-child(3) {
    transform: translateY(40px);
}

#fab-menu .btn:nth-child(4) {
    transform: translateY(15px);
}

/* When open: enable pointer events and run animations */
#fab-menu.open .btn {
    pointer-events: auto;
}

#fab-menu.open .btn:nth-child(1) {
    animation: fabUp 0.3s ease forwards;
}

#fab-menu.open .btn:nth-child(2) {
    animation: fabUp2 0.18s ease 0.2s forwards;
}

#fab-menu.open .btn:nth-child(3) {
    animation: fabUp2 0.2s ease 0.18s forwards;
}

#fab-menu.open .btn:nth-child(4) {
    animation: fabUp2 0.15s ease 0.15s forwards;
}

@keyframes fabUp {
    0% {
        opacity: 0;
    }

    15% {
        opacity: 0.8;
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fabUp2 {
    0% {
        opacity: 0;
    }

    50% {
        opacity: 0.8;
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ----------------------------------------------------------
   CLOSE BUTTON
   w-12 h-12 rounded-full bg-black border-2 border-white/60
   shadow flex items-center justify-center transition
   IMPORTANT: display:none by default — JS sets display:flex on open
   ---------------------------------------------------------- */
#fab-close {
    display: none;
    /* hidden until FAB menu opens */
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    background-color: #000000;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 14.3px rgba(0, 0, 0, 0.27);
    transition: all 0.3s;
    cursor: pointer;
}

/* Close icon: w-3 h-auto */
.icon-message {
    width: 0.75rem;
    height: auto;
}

/* ----------------------------------------------------------
   BOTTOM ROW  (label + main trigger button)
   relative flex flex-row-reverse items-center gap-2
   ---------------------------------------------------------- */
#fab-row {
    position: relative;
    display: flex;
    flex-direction: row-reverse;
    /* button on right, label on left */
    align-items: center;
    gap: 0.5rem;
}

/* ----------------------------------------------------------
   MAIN TRIGGER BUTTON
   cursor-pointer w-12 h-12 rounded-full bg-black border-2
   border-white/60 shadow flex items-center justify-center
   transition duration-300
   ---------------------------------------------------------- */
#fab-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    background-color: #000000;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 14.3px rgba(0, 0, 0, 0.27);
    transition: all 0.3s;
    cursor: pointer;
}

/* Trigger icon: w-[21px] */
.fab-button-icon {
    width: 21px;
}

/* ----------------------------------------------------------
   TOOLTIP LABEL
   px-4 py-1 bg-black text-white rounded-full relative
   flex items-center justify-center transition duration-300
   text-xs  +  peer-hover:opacity-0
   ---------------------------------------------------------- */
#fab-label {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0.25rem 1rem;
    background-color: #000000;
    color: #ffffff;
    border-radius: 9999px;
    font-size: 0.75rem;
    line-height: 1rem;
    transition: opacity 0.3s;
    white-space: nowrap;
}

/* peer-hover:opacity-0 — hide label when main button is hovered
   #fab-button comes before #fab-label in DOM → use ~ combinator */
#fab-button:hover~#fab-label {
    opacity: 0;
}

/* Arrow pointing right toward the button (already in cms.css) */
#fab-label::after {
    position: absolute;
    content: "";
    width: 12px;
    height: 12px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    right: -1px;
    background: black;
}

/* ----------------------------------------------------------
   OVERLAY
   fixed inset-0 bg-black/75 opacity-0 pointer-events-none
   transition duration-300 z-[102]
   ---------------------------------------------------------- */
#phone-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 102;
}

#phone-overlay.overlay-show {
    opacity: 1;
    pointer-events: auto;
}

/* ----------------------------------------------------------
   PHONE POPUP
   fixed top-0 left-1/2 -translate-x-1/2 -translate-y-full
   bg-white p-3 z-[103] w-[90vw] max-w-[455px]
   ---------------------------------------------------------- */
#phone-popup {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background-color: #ffffff;
    padding: 0.75rem;
    transition: top 0.35s ease;
    z-index: 103;
    width: 90vw;
    max-width: 455px;
}

#phone-popup.popup-show {
    top: 50%;
}

/* Popup heading: text-xs font-semibold inline-block p-3 text-red-400 leading-none uppercase */
.popup-heading {
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    padding: 0.75rem;
    color: #f87171;
    line-height: 1;
    text-transform: uppercase;
}

/* Popup body: text-sm p-2 | sm: text-xl p-3 */
.popup-content {
    font-size: 0.875rem;
    padding: 0.5rem;
}

@media (min-width: 640px) {
    .popup-content {
        font-size: 1.25rem;
        padding: 0.75rem;
    }
}

/* Popup row: flex justify-between items-center */
.popup-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Left group: flex items-center gap-2 | lg: gap-3 */
.popup-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (min-width: 1024px) {
    .popup-info {
        gap: 0.75rem;
    }
}

/* Phone icon: w-5 h-5 object-contain */
.popup-phone-icon {
    width: 1.25rem;
    height: 1.25rem;
    object-fit: contain;
}

/* Phone number link: text-[#FF0000] font-medium */
.popup-tel {
    color: #FF0000;
    font-weight: 500;
    text-decoration: none;
}
