/* ==========================================================================
   Mobile Stacked Sidebar (Refined) - Right Sidebar + Glass Button
   ========================================================================== */

#coodot-mobile-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    width: 80%;
    height: 100%;
    max-width: 320px;
    background: #f8f9fa;
    z-index: 1;
    /* Behind body wrapper */
    visibility: hidden;
    /* Base state hidden */
    transition: visibility 0.1s linear 0.3s;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    padding-bottom: 100px;
    /* Space for button */
    box-sizing: border-box;
}

body.mobile-sidebar-open #coodot-mobile-sidebar {
    visibility: visible;
    /* Show when open */
    transition-delay: 0s;
}

#coodot-body-wrapper {
    position: relative;
    z-index: 10;
    /* Above sidebar */
    width: 100%;
    min-height: 100vh;
    background: #fff;
    /* Use center right origin to keep the right edge aligned somewhat */
    transform-origin: right center;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), border-radius 0.4s ease;
    will-change: transform;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

/* Open State */
body.mobile-sidebar-open {
    overflow: hidden;
    background: #f8f9fa;
}

body.mobile-sidebar-open #coodot-body-wrapper {
    /* Slide LEFT (-80%) and Scale (0.92) 
       This moves the body to the left, revealing the right sidebar.
       Vertical centering is implicit via scale from center Y. */
    transform: translateX(-80%) scale(0.92);
    border-radius: 30px;
    /* More rounded as requested */
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
    /* Shadow on left? No, shadow should be on Right edge because sidebar is Right. */
    box-shadow: 10px 0 50px rgba(0, 0, 0, 0.2);
    /* Shadow on the RIGHT edge of the body */
    pointer-events: none;
    cursor: pointer;
}

/* Sidebar Inner Styling */
.sidebar-user-card {
    padding: 15px;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

/* Close Button Wrapper */
.sidebar-close-btn-wrapper {
    position: absolute;
    bottom: 40px;
    right: 30px;
    z-index: 20;

    /* CRITICAL FIX: Hide by default so it doesn't show over normal content */
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Show Button Only When Sidebar Open */
body.mobile-sidebar-open .sidebar-close-btn-wrapper {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition-delay: 0.2s;
    /* Pop in after slide */
}

.btn-liquid-glass-close {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #333;
    font-size: 24px;

    /* Liquid Glass Effect */
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

.btn-liquid-glass-close:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.8);
}