/*
 * Shell geometry is owned centrally: the runtime measures the global header.
 * Every Bottom Sheet is content-driven and grows only until the available
 * space is exhausted; overflow then scrolls inside the sheet. Historical
 * content/workspace class names remain compatibility hooks only and do not
 * change shell height. Feature CSS styles content, not shell geometry.
 * See backend/bottom_sheet_contract.json for the canonical contract/formulas.
 */
.bottom-sheet-overlay {
    position: absolute;
    inset: 0;
    background: rgba(51, 51, 51, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition:
        opacity var(--motion-sheet-close, 310ms) var(--motion-ease, cubic-bezier(.2, .8, .2, 1)),
        visibility 0s linear var(--motion-sheet-close, 310ms);
    z-index: 50;
    overflow: hidden;
    pointer-events: none;
}

.bottom-sheet-overlay.active,
.bottom-sheet-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
        opacity var(--motion-sheet-open, 360ms) var(--motion-ease, cubic-bezier(.2, .8, .2, 1)),
        visibility 0s linear 0s;
}

.bottom-sheet-overlay.is-closing {
    pointer-events: none;
}

.bottom-sheet {
    --panel-global-header-height: 0px;
    --panel-sheet-top-gap: var(--space-12, 12px);
    --panel-sheet-available-height: 100%;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    background: white;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    visibility: hidden;
    transition:
        transform var(--motion-sheet-close, 310ms) var(--motion-ease, cubic-bezier(.2, .8, .2, 1)),
        visibility 0s linear var(--motion-sheet-close, 310ms);
    z-index: 60;
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: var(--panel-sheet-available-height);
    transform: translateY(100%);
    touch-action: pan-y;
    pointer-events: none;
}

/* Historical variant names are geometry-neutral. Content determines height. */
.bottom-sheet--content,
.bottom-sheet--workspace,
.bottom-sheet--content.expanded,
.bottom-sheet--workspace.expanded {
    height: auto;
    max-height: var(--panel-sheet-available-height);
}

/* Explicit signup exception: the activity signup form uses the full area
   available below the global header. The ordinary activity detail remains
   content-driven. */
#bottom_sheet_activity_detail:has([data-activity-detail-view="form"]:not(.hidden)) {
    height: var(--panel-sheet-available-height);
    max-height: var(--panel-sheet-available-height);
}

.bottom-sheet.is-dragging {
    transition: none !important;
    will-change: transform;
}

.bottom-sheet.active,
.bottom-sheet.open {
    transform: translateY(0);
    visibility: visible;
    transition:
        transform var(--motion-sheet-open, 360ms) var(--motion-ease, cubic-bezier(.2, .8, .2, 1)),
        visibility 0s linear 0s;
    pointer-events: auto;
}

/* Desktop base fallback. The final explicit drawer/dialog presentation is in
   desktop-preview-sheets.css and is loaded by desktop-preview-navigation.js. */
@media (min-width: 931px) {
    body.desktop-preview-shell .bottom-sheet { --panel-sheet-top-gap: 0px; }
    body.desktop-preview-shell .bottom-sheet-overlay { position: fixed !important; top: var(--desktop-preview-header-height, 76px) !important; right: 0 !important; bottom: 0 !important; left: var(--desktop-preview-sidebar-width, 220px) !important; }
    body.desktop-preview-shell .bottom-sheet { position: fixed !important; top: var(--desktop-preview-header-height, 76px) !important; right: 0 !important; bottom: 0 !important; left: auto !important; height: auto !important; max-height: var(--panel-sheet-available-height) !important; transform: translateX(100%) !important; }
    body.desktop-preview-shell .bottom-sheet.active, body.desktop-preview-shell .bottom-sheet.open { transform: translateX(0) !important; }
}

@media (prefers-reduced-motion: reduce) {
    .bottom-sheet-overlay {
        transition:
            opacity 1ms linear,
            visibility 0s linear 1ms !important;
    }

    .bottom-sheet-overlay.active {
        transition-delay: 0s, 0s !important;
    }

    .bottom-sheet {
        transition-duration: 1ms, 0s !important;
        transition-delay: 0s, 1ms !important;
    }

    .bottom-sheet.active,
    .bottom-sheet.open {
        transition-delay: 0s, 0s !important;
    }
}

.bottom-sheet-header {
    flex-shrink: 0;
    background: white;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    z-index: 10;
}

/* A titleless sheet does not reserve a fake header strip just to carry X. */
.bottom-sheet-floating-close {
    position: absolute !important; z-index: 35 !important; top: 8px !important; right: 8px !important;
    width: 44px !important; min-width: 44px !important; height: 44px !important; min-height: 44px !important;
    margin: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important;
}

.bottom-sheet-content {
    flex: 0 1 auto;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

.bottom-sheet-content.overflow-y-auto,
.bottom-sheet-content .overflow-y-auto {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

/* Drag-to-dismiss remains available on the sheet itself; no visual handle is rendered. */
[data-bottom-sheet-drag-handle] {
    display: none !important;
}

[data-bottom-sheet-close] {
    min-width: 44px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

body.has-open-bottom-sheet #debug-user-switcher,
body.has-open-bottom-sheet #debug-show-btn {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: #ececec;
    border-radius: 10px;
}

.custom-scrollbar:hover::-webkit-scrollbar-thumb {
    background-color: #ececec;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #ececec transparent;
}
