/* ===== Font Import ===== */
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@400;500;600&display=swap');

/* ===== Floating Boss Wrapper ===== */
.floatingboss {
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 160px;
    z-index: 9999;
    font-family: 'Prompt', 'Sarabun', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* ===== All Icons Container ===== */
.allicons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: auto;
    padding-right: 15px;
}

/* ===== Floating Items (กรอบบางเฉียบ) ===== */
.floating-item {
    width: 42px;  /* ปรับขนาดให้กระชับขึ้น */
    height: 42px;
    background-color: #ffffff;
    border-radius: 50%;
    /* ใช้เงาฟุ้งๆ แทนขอบหนา ช่วยให้ดูมีมิติแต่ขอบไม่หนา */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); 
    border: none; /* เอาขอบออกเพื่อความบางสุด */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2);
}

.floating-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.floating-item img {
    /* ปรับเป็น 100% เพื่อให้รูปเต็มวงกลมพอดีเป๊ะ */
    width: 95%; 
    height: 95%;
    object-fit: contain; 
    transition: transform 0.3s ease;
}

/* Hover Effect: ขยายไอคอนและเน้นเงา */
.floating-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ===== Floating Image & Text (ตัวการ์ตูน) ===== */
.floating-img-text-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: 100%;
    pointer-events: none;
}

.floating-img {
    width: 120px;
    z-index: 2;
}

.floating-img img {
    width: 100%;
    height: auto;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.1));
}

.floating-text {
    position: absolute;
    right: 110px; /* Shift to the left of the image */
    top: 25px; /* Align with pointing finger */
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    background-color: #ffffff;
    padding: 6px 12px;
    border-radius: 15px;
    line-height: 1.4;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #f5f5f5;
    width: max-content;
    max-width: 180px;
    z-index: 10;
    animation: shake-side 4s ease-in-out infinite;
}

/* Speech bubble tail pointing right towards the finger */
.floating-text::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 0 6px 8px;
    border-style: solid;
    border-color: transparent transparent transparent #ffffff;
    display: block;
    width: 0;
    z-index: 11;
}

/* Speech bubble tail border for subtle depth */
.floating-text::before {
    content: '';
    position: absolute;
    right: -9px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 0 6px 9px;
    border-style: solid;
    border-color: transparent transparent transparent #f5f5f5;
    display: block;
    width: 0;
    z-index: 10;
}

/* ===== Responsive Breakpoints ===== */

/* Tablet */
@media (max-width: 992px) {
    .floatingboss { right: 15px; bottom: 15px; }
    .floating-item { width: 40px; height: 40px; }
    .floating-img { width: 100px; }
    .floating-text {
        right: 95px;
        top: 20px;
        font-size: 12px;
        padding: 5px 10px;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .floatingboss { right: 10px; bottom: 10px; width: 130px; }
    .allicons { padding-right: 8px; }
    .floating-item { width: 38px; height: 38px; }
    .floating-img { width: 85px; }
    .floating-text {
        right: 80px;
        top: 15px;
        font-size: 11px;
        padding: 4px 8px;
        max-width: 140px;
    }
}

/* Hide cartoon woman & bubble on mobile/tablet to prevent blocking content & overlapping stats */
@media (max-width: 768px) {
    .floating-img-text-wrapper {
        display: none !important;
    }
    .floatingboss {
        width: auto;
    }
}

/* Hide floating boss entirely when mobile navbar menu is open */
@media (max-width: 992px) {
    body:has(#navbarResponsive.show) .floatingboss,
    body:has(#navbarResponsive.collapsing) .floatingboss {
        display: none !important;
    }
}

/* ===== Animations ===== */
@keyframes shake-side {
    0%, 100% { transform: translateX(0); }
    10%, 20% { transform: translateX(-2px); }
    15%, 25% { transform: translateX(2px); }
    30% { transform: translateX(0); }
}

/* ===== Floating Toggle Button & Slide functionality ===== */
.floating-toggle-btn {
    position: fixed !important;
    right: 0 !important; /* Always stuck to the right edge of the screen */
    bottom: 180px !important; /* Balanced vertical position */
    width: 20px !important; /* Narrow tab width */
    height: 48px !important; /* Tab height */
    border-radius: 8px 0 0 8px !important; /* Rounded only on the left side */
    background: #dfb76c !important;
    color: #ffffff !important;
    border: 1px solid #ffffff !important;
    border-right: none !important; /* Flat on the right screen edge */
    box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    pointer-events: auto !important;
    z-index: 10000 !important;
}

.floating-toggle-btn:hover {
    background: #cda250 !important;
    width: 25px !important; /* Expands slightly when hovered */
}

.floating-toggle-btn i {
    font-size: 0.75rem !important;
    transition: transform 0.3s ease !important;
}

/* Base transitions for smooth interactive slide */
.allicons, .floating-img-text-wrapper, .floating-img, .floating-text {
    transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

/* Closed state styling */
.floatingboss.closed {
    transform: translateX(180px) !important; /* Slide elements fully off-screen */
}

.floatingboss.closed .allicons {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(20px) scale(0.8) !important;
}

.floatingboss.closed .floating-img-text-wrapper {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.8) !important;
}

/* Toggle button rotation when closed */
.floating-toggle-btn.closed i {
    transform: rotate(180deg) !important; /* Points left when closed */
}

/* Adjust toggle position for tablets and smaller screens where helper graphic is hidden */
@media (max-width: 768px) {
    .floating-toggle-btn {
        bottom: 80px !important;
        height: 40px !important;
    }
    
    .floatingboss.closed {
        transform: translateX(80px) !important;
    }
}