/* Drawer detach — pop-out/float controls injected into every
   .offcanvas.app-drawer header by drawer-detach.js, plus the two
   alternate rendering states those controls switch a drawer into.
   See drawer-detach.js's own header comment for the full design. */

.drawer-detach-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.5rem;
}

.drawer-detach-float-btn,
.drawer-detach-popout-btn {
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--bs-secondary-color, #6c757d);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.drawer-detach-float-btn:hover,
.drawer-detach-popout-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--bs-body-color, #212529);
}

:root[data-bs-theme="dark"] .drawer-detach-float-btn:hover,
:root[data-bs-theme="dark"] .drawer-detach-popout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.app-drawer.is-floating.is-floating {
    /* Doubled selector beats the plain .offcanvas.offcanvas-end rule's
       specificity without needing !important on every property. */
    position: fixed;
    inset: auto;
    top: 90px;
    left: 50%;
    margin-left: -230px;
    right: auto;
    bottom: auto;
    width: 460px;
    max-width: 92vw;
    height: 72vh;
    max-height: 88vh;
    min-width: 320px;
    min-height: 240px;
    transform: none;
    visibility: visible;
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-drawer.is-floating .offcanvas-header {
    cursor: move;
    user-select: none;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
    flex: 0 0 auto;
}

.app-drawer.is-floating .offcanvas-body {
    flex: 1 1 auto;
    overflow: auto;
}

.drawer-detach-resize-grip {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    opacity: 0.45;
    background:
        linear-gradient(135deg, transparent 0%, transparent 45%, currentColor 45%, currentColor 55%, transparent 55%, transparent 100%),
        linear-gradient(135deg, transparent 0%, transparent 65%, currentColor 65%, currentColor 75%, transparent 75%, transparent 100%);
    color: var(--bs-secondary-color, #6c757d);
}

.drawer-detach-resize-grip:hover {
    opacity: 0.9;
}

/* Popped-out mode: the drawer fills the whole popup window instead of
   sliding in as a narrow strip, and its own detach controls (there is
   nothing left to pop out from within a popup) are hidden. */
body.drawer-popout-body {
    margin: 0;
    overflow: hidden;
}

.app-drawer.is-popped-out.is-popped-out {
    position: static;
    transform: none;
    visibility: visible;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    box-shadow: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.app-drawer.is-popped-out .offcanvas-body {
    flex: 1 1 auto;
    overflow: auto;
}

.app-drawer.is-popped-out .drawer-detach-controls {
    display: none;
}
