/**
 * Nút liên hệ trôi nổi (Floating Contact Button)
 * Yêu cầu: HTML/CSS thuần, không thư viện, CSS3 (blur, gradient, boder-radius sâu)
 */

/* --- CSS for Floating Contact Button VDW --- */
.fcv-contact-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000000;
    /* Cao nhất web */
}

/* Background Overlay làm mờ xung quanh */
.fcv-overlay-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    pointer-events: none;
    /* Không chặn click khi đang ẩn */
}

.fcv-contact-widget.is-open .fcv-overlay-bg {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    /* Lúc hiện mới chặn click vào nền */
}

/* FAB chính (Nút tròn) */
.fcv-fab-main {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    /* Đảm bảo nổi trên tất cả */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* === Floating Action Button (FAB) === */
.fcv-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    /* Gradient xanh dương tới xanh nhạt */
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border: none;
    outline: none;
    cursor: pointer;
    /* Đổ bóng lớn và mềm */
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 10;
    /* Luôn nổi trên overlay */
    padding: 0;
    margin: 0 !important;
}

/* Hiệu ứng hover cho nút gốc */
.fcv-fab:hover {
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.5);
    transform: translateY(-2px);
}

/* Hiệu ứng nhấn active */
.fcv-fab:active {
    transform: scale(0.9);
}

/* Style cho các icon FA để switch mượt */
.fcv-icon {
    position: absolute;
    color: #ffffff;
    font-size: 24px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: absolute;
    color: #ffffff;
    font-size: 24px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Icon close mặc định ẩn & xoay nhẹ */
.fcv-icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

/* Icon chat mặc định hiển thị */
.fcv-icon-chat {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* === Khi ở trạng thái MỞ (.is-open) === */
.fcv-contact-widget.is-open .fcv-fab {
    /* Nút đổi màu nhạt hơn */
    background: linear-gradient(135deg, #60a5fa, #93c5fd);
    box-shadow: 0 8px 15px rgba(96, 165, 250, 0.3);
}

.fcv-contact-widget.is-open .fcv-icon-chat {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

.fcv-contact-widget.is-open .fcv-icon-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* === Lớp Overlay Menu === */
.fcv-overlay-menu {
    position: absolute;
    bottom: 80px;
    /* Cách nút FAB lên trên */
    right: 0;
    width: 280px;
    max-width: calc(100vw - 48px);
    /* Responsive di động (không vuợt quá full mh) */

    /* Hiệu ứng nền trong suốt và kính mờ (glassmorphism) */
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    /* Góc bo sâu cực lớn */
    border-radius: 25px;
    padding: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);

    /* Ẩn ban đầu */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transform-origin: bottom right;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
    /* Nằm TRÊN overlay-bg (z-index: 1) */
}

/* Mở overlay menu với Slide-up và Fade-in */
.fcv-contact-widget.is-open .fcv-overlay-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    /* Gắn animation keyframe mượt */
    animation: fcv-fade-slide-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Keyframes cho xuất hiện từ dưới lên */
@keyframes fcv-fade-slide-up {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

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

/* Tiêu đề & phụ đề */
.fcv-menu-header {
    text-align: center;
    margin-bottom: 20px;
}

.fcv-title {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 4px 0;
    line-height: 1.2;
}

.fcv-subtitle {
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    letter-spacing: 0.1em;
    /* Giãn cách chữ lớn */
    text-transform: uppercase;
    display: block;
}

/* Danh sách mạng xã hội / Liên hệ */
.fcv-contact-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Từng box mục */
.fcv-contact-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: rgba(243, 244, 246, 0.6);
    /* Nhạt trong */
    border-radius: 99px;
    /* Tròn sâu */
    text-decoration: none;
    transition: all 0.3s ease;
}

/* Hover từng dòng sẽ đẩy qua phải nhẹ */
.fcv-contact-item:hover {
    background: rgba(229, 231, 235, 1);
    transform: translateX(5px);
    /* Hiệu ứng điệu đà */
    text-decoration: none;
}

/* Icon / Hình ảnh Social */
.fcv-contact-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: contain;
    margin-right: 12px;
    flex-shrink: 0;
}

/* Nếu box item không có icon sẽ hiển thị tròn màu xám thay thế */
.fcv-no-icon {
    background: #d1d5db;
    display: inline-block;
}

/* Text Social Bên Phải */
.fcv-contact-text {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
}


}

/* =============================================
   CONTACT WIDGET WRAPPER
   ============================================= */
.fcv-contact-widget {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

/* =============================================
   RIGHT CONTACT SIDEBAR — Desktop only (769px+)
   ============================================= */
.fcv-sidebar {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 7px;
    align-items: flex-end;
    z-index: 1000000;
}

.fcv-sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 58px;
    min-height: 58px;
    padding: 5px;
    overflow: hidden;
    text-decoration: none;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 13px 0 0 13px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .18);
}

.fcv-sidebar-item:hover,
.fcv-sidebar-item:focus-visible {
    text-decoration: none;
}

.fcv-sidebar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    overflow: hidden;
    border-radius: 9px;
}

.fcv-sidebar-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fcv-sidebar-icon-empty {
    background: #2563eb;
}

.fcv-sidebar-label {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    color: #374151;
}

/* =============================================
   BOTTOM BAR — Mobile & Tablet (≤768px)
   ============================================= */
.fcv-bottom-bar {
    display: none; /* Ẩn trên desktop */
    align-items: stretch;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999999;

    /* Nền trắng + bo tròn trên */
    background: #ffffff;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;

    /* Đổ bóng nhẹ phía trên */
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08),
                0 -1px 6px rgba(0, 0, 0, 0.04);

    /* Khoảng cách nội dung */
    padding: 6px 0;
    padding-bottom: env(safe-area-inset-bottom, 6px);

    /* Animation nhẹ khi xuất hiện */
    animation: fcv-bar-slide-up 0.4s ease forwards;
}

@keyframes fcv-bar-slide-up {
    0%   { transform: translateY(100%); opacity: 0; }
    100% { transform: translateY(0);     opacity: 1; }
}

/* Mỗi item: cột nhỏ = icon + label */
.fcv-bottom-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.fcv-bottom-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 17px;
    transition: all 0.25s ease;
}

.fcv-bottom-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fcv-bottom-label {
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    color: #374151;
    transition: color 0.25s ease;
}

/* =============================================
   RESPONSIVE — Mobile & Tablet
   ============================================= */
@media (max-width: 768px) {
    .fcv-sidebar {
        display: none !important;
    }

    .fcv-bottom-bar {
        display: flex;
    }
}

/* Ẩn bottom bar khi mobile menu của Flatsome đang mở */
body.mfp-open .fcv-bottom-bar,
body.fcv-mobile-menu-open .fcv-bottom-bar,
.mfp-wrap.mfp-ready .fcv-bottom-bar,
.mfp-wrap.mfp-visible .fcv-bottom-bar,
#main-menu.mfp-ready ~ .fcv-bottom-bar,
#main-menu.mfp-visible ~ .fcv-bottom-bar {
    display: none !important;
}

/* =============================================
   RESPONSIVE — Desktop only
   ============================================= */
@media (min-width: 769px) {
    .fcv-sidebar {
        display: flex;
    }

    .fcv-bottom-bar {
        display: none !important;
    }
}

/* =============================================
   HIDE OLD ELEMENTS
   ============================================= */
.fcv-overlay-bg,
.fcv-overlay-menu,
.fcv-fab {
    display: none !important;
}

/* =============================================
   BOTTOM BAR — Mobile & Tablet
   ============================================= */
.fcv-bottom-bar {
    display: flex; /* Hiện mặc định trên mobile */
    align-items: stretch;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999999;

    /* Nền trắng + bo tròn trên */
    background: #ffffff;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;

    /* Đổ bóng nhẹ phía trên */
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08),
                0 -1px 6px rgba(0, 0, 0, 0.04);

    /* Khoảng cách nội dung */
    padding: 6px 0;
    padding-bottom: env(safe-area-inset-bottom, 6px);

    /* Animation nhẹ khi xuất hiện */
    animation: fcv-bar-slide-up 0.4s ease forwards;
}

@keyframes fcv-bar-slide-up {
    0%   { transform: translateY(100%); opacity: 0; }
    100% { transform: translateY(0);     opacity: 1; }
}

/* Mỗi item: cột nhỏ = icon + label */
.fcv-bottom-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

.fcv-bottom-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 17px;
    transition: all 0.25s ease;
}

.fcv-bottom-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fcv-bottom-label {
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    color: #374151;
    transition: color 0.25s ease;
}

/* Tablet specific adjustments */
@media (min-width: 641px) and (max-width: 768px) {
    .fcv-bottom-bar {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 18px 18px 0 0;
    }
}

/* Desktop: không hiển thị bottom bar, giữ nguyên FAB */
@media (min-width: 769px) {
    .fcv-bottom-bar {
        display: none !important;
    }

    body {
        padding-bottom: 0;
    }
}