/* ==========================================================================
   CM BAM — Filter Button & Drawer
   ========================================================================== */

/* --------------------------------------------------------------------------
   "Filtrer" button — visible only when sidebar is hidden on that breakpoint
   -------------------------------------------------------------------------- */

.cm-bam-filter-btn-wrap {
    margin-bottom: 16px;
}

.cm-bam-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    height: 40px;
    background: var(--theme-palette-color-1, #2271b1);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.cm-bam-filter-btn:hover,
.cm-bam-filter-btn:focus-visible {
    background: var(--theme-palette-color-2, #135e96);
    color: #fff;
    outline: 2px solid var(--theme-palette-color-1, #2271b1);
    outline-offset: 2px;
}

.cm-bam-filter-btn svg {
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Backdrop
   -------------------------------------------------------------------------- */

#cm-bam-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99997;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#cm-bam-drawer-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Drawer panel
   -------------------------------------------------------------------------- */

#cm-bam-drawer {
    position: fixed;
    top: var(--wp-admin--admin-bar--height, 0px);
    right: 0;
    width: 340px;
    max-width: 92vw;
    height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
    background: #fff;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -2px 0 24px rgba(0, 0, 0, 0.15);
}

#cm-bam-drawer.is-open {
    transform: translateX(0);
}

/* Drawer header */
.cm-bam-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.cm-bam-drawer-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #1a1a1a;
    line-height: 1.3;
}

.cm-bam-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    color: #555;
    padding: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.cm-bam-drawer-close:hover,
.cm-bam-drawer-close:focus-visible {
    background: #f3f4f6;
    border-color: #999;
    color: #111;
    outline: 2px solid #999;
    outline-offset: 2px;
}

.cm-bam-drawer-close svg {
    flex-shrink: 0;
}

/* Drawer body — scrollable filter widgets */
.cm-bam-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 24px;
    overscroll-behavior: contain;
}

.cm-bam-drawer-body .cm-bam-filter-widget {
    padding-bottom: 24px;
}

/* --------------------------------------------------------------------------
   Body scroll lock
   -------------------------------------------------------------------------- */

body.cm-bam-no-scroll {
    overflow: hidden;
}
