/* ==========================================================================
   Global Floating Menu Styles (Smart Position Final Version)
   ========================================================================== */

/* অ্যানিমেশনের জন্য Keyframes */
@keyframes pulsate {
    0% {
        transform: scale(0.9);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* --- পজিশনিং --- */
.anewbd-floating-menu-container.is-global {
    position: fixed;
    bottom: 30px;
    right: 14px;
    z-index: 998;
    transition: bottom 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.anewbd-floating-menu-container.is-global.move-up {
    bottom: 90px;
}

.anewbd-floating-menu-container.is-shortcode {
    position: relative;
    display: inline-block;
}

/* --- কমন ডিজাইন --- */
.floating-menu-trigger {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    background-color: #27ae60;
    color: #ffffff;
    border-radius: 50%;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    font-size: 18px;
    border: 2px solid #ffffff;
}

.floating-menu-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.floating-menu-trigger>i {
    position: relative;
    z-index: 2;
}

.pulsating-rings {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.pulsating-rings .ring {
    position: absolute;
    top: -2px;
    left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    background-color: #27ae60;
    border-radius: 50%;
    opacity: 0;
    animation: pulsate 2.5s infinite cubic-bezier(0.25, 0.8, 0.25, 1);
}

.pulsating-rings .ring:nth-child(2) {
    animation-delay: 0.8s;
}

.pulsating-rings .ring:nth-child(3) {
    animation-delay: 1.6s;
}

.floating-menu-trigger .trigger-tooltip {
    position: absolute;
    right: 100%;
    margin-right: 15px;
    padding: 8px 15px;
    background-color: #333;
    color: #fff;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.3s ease;
}

.floating-menu-trigger:hover .trigger-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* --- ফ্লোটিং আইটেম মেনুর নতুন "বুদ্ধিমান" পজিশনিং --- */
.floating-menu-items {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: #ffffff;
    padding: 8px;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ডিফল্ট: উপরে এবং মাঝখানে খুলবে */
.floating-menu-items {
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translate(-50%, 10px);
}

.anewbd-floating-menu-container.is-active .floating-menu-items {
    transform: translate(-50%, 0);
    opacity: 1;
    visibility: visible;
}

/* মডিফায়ার: নিচে খোলার জন্য */
.anewbd-floating-menu-container.opens-down .floating-menu-items {
    bottom: auto;
    top: calc(100% + 12px);
    transform: translate(-50%, -10px);
}

.anewbd-floating-menu-container.is-active.opens-down .floating-menu-items {
    transform: translate(-50%, 0);
}

/* মডিফায়ার: বামে খোলার জন্য */
.anewbd-floating-menu-container.opens-left .floating-menu-items {
    left: auto;
    right: 0;
    transform: translate(0, 10px);
}

.anewbd-floating-menu-container.is-active.opens-left .floating-menu-items {
    transform: translate(0, 0);
}

/* মডিফায়ার: ডানে খোলার জন্য */
.anewbd-floating-menu-container.opens-right .floating-menu-items {
    left: 0;
    right: auto;
    transform: translate(0, 10px);
}

.anewbd-floating-menu-container.is-active.opens-right .floating-menu-items {
    transform: translate(0, 0);
}

/* --- আইটেম বাটনের স্টাইল --- */
.floating-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    border-radius: 8px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.floating-menu-item:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.floating-menu-item.phone-item {
    background-color: #007bff;
}

.floating-menu-item.whatsapp-item {
    background-color: #25D366;
}

.floating-menu-item.email-item {
    background-color: #6c757d;
}

.floating-menu-item.facebook-item {
    background-color: #1877F2;
}

.floating-menu-item.youtube-item {
    background-color: #FF0000;
}

.floating-menu-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}


/* ===================================================================
   Mobile View - Final Smart Interaction & Responsive Size
   =================================================================== */
@media (max-width: 768px) {

    /* --- ধাপ ১: মোবাইল ভিউতে বাটনের আকার ছোট করা হলো --- */
    .anewbd-floating-menu-container.is-global .floating-menu-trigger {
        width: 45px;       /* নতুন প্রস্থ */
        height: 45px;      /* নতুন উচ্চতা */
        font-size: 16px;   /* আইকনের আকার */
        border-width: 2px; /* বর্ডারের প্রস্থ */
    }

    /* অ্যানিমেশনের রিংগুলোকে নতুন আকারের সাথে মানিয়ে নেওয়া হলো */
    .anewbd-floating-menu-container.is-global .pulsating-rings .ring {
        top: -2px;
        left: -2px;
        width: calc(100% + 4px);
        height: calc(100% + 4px);
    }
    
    /* হোভার টেক্সট (Tooltip) এর আকার ও অবস্থান ঠিক করা হলো */
    .anewbd-floating-menu-container.is-global .trigger-tooltip {
        font-size: 13px;
        padding: 6px 12px;
        margin-right: 12px;
    }


    /* --- ধাপ ২: ডিফল্ট অবস্থা (যখন ট্যাব বার দৃশ্যমান) --- */
    /* বাটনটিকে ট্যাব বারের ঠিক উপরে রাখা হলো */
    .anewbd-floating-menu-container.is-global,
    .anewbd-floating-menu-container.is-global.move-up {
        bottom: 72px; /* 60px (ট্যাব বার) + 12px (ফাঁকা জায়গা) */
        right: 12px;
    }


    /* --- ধাপ ৩: যখন ট্যাব বার হাইড হয়ে যায় --- */
    /* বাটনটি নিচে নেমে আসবে */
    body.tab-bar-is-hidden .anewbd-floating-menu-container.is-global,
    body.tab-bar-is-hidden .anewbd-floating-menu-container.is-global.move-up {
        bottom: 20px; /* স্ক্রিনের কোণায় সুন্দরভাবে অবস্থান করবে */
        right: 12px;
    }
}