/* MR bottom-sheet CSS — ITER 298 (BS-paralel)
   ─────────────────────────────────────────────────────────────────
   Mobile-first bottom sheet with drag-to-dismiss handle. Use for
   filter pickers, action menus, settings panels.

   Markup:
     <div class="bs-sheet" id="filterSheet" hidden>
       <div class="bs-sheet-backdrop"></div>
       <div class="bs-sheet-panel" role="dialog" aria-modal="true">
         <div class="bs-sheet-handle-area">
           <div class="bs-sheet-handle"></div>
         </div>
         <div class="bs-sheet-header">
           <h3 class="bs-sheet-title">Başlık</h3>
           <button class="bs-sheet-close" aria-label="Kapat"></button>
         </div>
         <div class="bs-sheet-body">...</div>
         <div class="bs-sheet-footer">...</div>
       </div>
     </div>

   States:
     [hidden] → display:none
     .is-opening → entering animation
     .is-open → fully visible
     .is-closing → exit animation
     .is-dragging → user dragging panel (transition removed)

   Variants:
     .bs-sheet--full   panel takes 100vh (modal-like)
     .bs-sheet--half   panel limited to 50vh
     .bs-sheet--auto   panel fits content (default; max 85vh)

   Tokens:
     --bs-sheet-bg:        rgba(20,24,32,0.98)
     --bs-sheet-radius:    16px
     --bs-sheet-handle:    rgba(255,255,255,0.3)
*/

:root {
  --bs-sheet-bg: rgba(20, 24, 32, 0.98);
  --bs-sheet-radius: 16px;
  --bs-sheet-handle: rgba(255, 255, 255, 0.30);
  --bs-sheet-border: rgba(255, 255, 255, 0.10);
  --bs-sheet-text: #fff;
  --bs-sheet-z: 9000;
}

.bs-sheet {
  position: fixed;
  inset: 0;
  z-index: var(--bs-sheet-z);
  pointer-events: none;
}
.bs-sheet[hidden] { display: none !important; }
.bs-sheet.is-open,
.bs-sheet.is-opening,
.bs-sheet.is-closing { pointer-events: auto; }

.bs-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.bs-sheet.is-open .bs-sheet-backdrop,
.bs-sheet.is-opening .bs-sheet-backdrop {
  opacity: 1;
}
.bs-sheet.is-closing .bs-sheet-backdrop {
  opacity: 0;
}

.bs-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85vh;
  background: var(--bs-sheet-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-radius: var(--bs-sheet-radius) var(--bs-sheet-radius) 0 0;
  border: 1px solid var(--bs-sheet-border);
  border-bottom: 0;
  color: var(--bs-sheet-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translate3d(0, 100%, 0);
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  /* Account for iOS safe area */
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bs-sheet.is-open .bs-sheet-panel,
.bs-sheet.is-opening .bs-sheet-panel {
  transform: translate3d(0, 0, 0);
}
.bs-sheet.is-closing .bs-sheet-panel {
  transform: translate3d(0, 100%, 0);
}
.bs-sheet.is-dragging .bs-sheet-panel {
  transition: none !important;
}

.bs-sheet--full .bs-sheet-panel { max-height: 100vh; height: 100vh; }
.bs-sheet--half .bs-sheet-panel { max-height: 50vh; }
.bs-sheet--auto .bs-sheet-panel { max-height: 85vh; }

/* Drag handle area — taller than the visible bar to make grabbing easier */
.bs-sheet-handle-area {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  flex: 0 0 auto;
  cursor: grab;
  touch-action: none;
}
.bs-sheet-handle-area:active {
  cursor: grabbing;
}
.bs-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--bs-sheet-handle);
}

.bs-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 12px;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--bs-sheet-border);
}
.bs-sheet-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: var(--bs-sheet-text);
}
.bs-sheet-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 160ms ease;
  -webkit-tap-highlight-color: transparent;
}
.bs-sheet-close:hover {
  background: rgba(255, 255, 255, 0.08);
}
.bs-sheet-close::before {
  content: '';
  width: 16px;
  height: 16px;
  background-color: rgba(255, 255, 255, 0.7);
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><line x1='18' y1='6' x2='6' y2='18'/><line x1='6' y1='6' x2='18' y2='18'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><line x1='18' y1='6' x2='6' y2='18'/><line x1='6' y1='6' x2='18' y2='18'/></svg>");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.bs-sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  overscroll-behavior: contain;
}

.bs-sheet-footer {
  flex: 0 0 auto;
  padding: 12px 16px;
  border-top: 1px solid var(--bs-sheet-border);
  display: flex;
  gap: 8px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .bs-sheet-backdrop,
  .bs-sheet-panel {
    transition: none !important;
  }
}
