/* =============================================================================
   BOTTOM SHEET - Reusable Mobile Component
   Only active at max-width: 767px. On desktop, content stays inline.

   Usage:
   - Add data-bottom-sheet="id" to trigger element
   - Add .bottom-sheet with data-sheet-id="id" to sheet element
   - Call BrandnerBottomSheet.open('id') / .close('id') programmatically
   ============================================================================= */

/* Overlay */
.bottom-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.bottom-sheet-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Sheet Container */
.bottom-sheet {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #fff;
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
    transform: translateY(100%);
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    will-change: transform;
}

.bottom-sheet.open {
    transform: translateY(0);
    pointer-events: auto;
}

/* Drag Handle */
.bottom-sheet-handle {
    display: flex;
    justify-content: center;
    padding: 12px 0 4px;
    cursor: grab;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

.bottom-sheet-handle::before {
    content: '';
    width: 36px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
}

/* Sheet Content - scrollable */
.bottom-sheet-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    max-height: calc(85vh - 40px);
    padding: 8px 20px 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

/* Header area (optional) */
.bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 12px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 12px;
}

.bottom-sheet-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.bottom-sheet-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: #6b7280;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.bottom-sheet-close:hover {
    background: #e5e7eb;
}

/* Only active on mobile */
@media (min-width: 768px) {
    .bottom-sheet-overlay,
    .bottom-sheet {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .bottom-sheet-overlay {
        display: block;
    }

    .bottom-sheet {
        display: block;
    }
}

/* Body scroll lock when sheet is open */
body.bottom-sheet-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    touch-action: none;
}

/* Focus trap visual indicator */
.bottom-sheet:focus-visible {
    outline: 2px solid #1e3a5f;
    outline-offset: -2px;
}
