/* ==========================================================================
   AIRH Bottom Sheet — Futuristic Neumorphism
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Overlay / Backdrop
   --------------------------------------------------------------------------- */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--color-backdrop);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: var(--z-sheet);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-sheet),
    visibility var(--transition-sheet);
}

.bottom-sheet-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* ---------------------------------------------------------------------------
   Sheet Container — Raised neumorphic
   --------------------------------------------------------------------------- */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: calc(var(--z-sheet) + 1);
  background: var(--color-bg-primary);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  box-shadow: var(--neu-raised-lg);
  transform: translateY(100%);
  transition: transform var(--transition-sheet);
  max-height: 95vh;
  max-height: 95dvh;
  display: flex;
  flex-direction: column;
  will-change: transform;
}

/* States */
.bottom-sheet.is-peek { transform: translateY(70%); }
.bottom-sheet.is-half { transform: translateY(50%); }
.bottom-sheet.is-full { transform: translateY(10%); }
.bottom-sheet.is-open { transform: translateY(0); }

/* ---------------------------------------------------------------------------
   Drag Handle — Neumorphic pill
   --------------------------------------------------------------------------- */
.bottom-sheet__handle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) 0 var(--space-1);
  cursor: grab;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.bottom-sheet__handle:active { cursor: grabbing; }

.bottom-sheet__handle-pill {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--color-text-tertiary);
  opacity: 0.4;
  transition: opacity var(--transition-fast),
    width var(--transition-fast);
}

.bottom-sheet__handle:hover .bottom-sheet__handle-pill {
  opacity: 0.7;
  width: 48px;
}

/* ---------------------------------------------------------------------------
   Header
   --------------------------------------------------------------------------- */
.bottom-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-6) var(--space-4);
  flex-shrink: 0;
}

.bottom-sheet__title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
}

.bottom-sheet__close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  background: var(--color-bg-primary);
  border: none;
  cursor: pointer;
  box-shadow: var(--neu-flat);
  transition: all 0.2s ease;
}

.bottom-sheet__close:hover {
  box-shadow: var(--neu-inset-sm);
  color: var(--color-text-primary);
}

/* ---------------------------------------------------------------------------
   Content
   --------------------------------------------------------------------------- */
.bottom-sheet__content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 var(--space-6) var(--space-6);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.bottom-sheet__content::after {
  content: '';
  display: block;
  height: env(safe-area-inset-bottom, 0);
}

/* ---------------------------------------------------------------------------
   Footer — Neumorphic
   --------------------------------------------------------------------------- */
.bottom-sheet__footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: none;
  flex-shrink: 0;
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0));
  position: relative;
}

.bottom-sheet__footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--space-6);
  right: var(--space-6);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-border-light), transparent);
}

/* ---------------------------------------------------------------------------
   States
   --------------------------------------------------------------------------- */
.bottom-sheet.is-dragging { transition: none; }

/* ---------------------------------------------------------------------------
   Desktop — Limit width
   --------------------------------------------------------------------------- */
@media (min-width: 640px) {
  .bottom-sheet {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  }

  .bottom-sheet.is-peek { transform: translateX(-50%) translateY(70%); }
  .bottom-sheet.is-half { transform: translateX(-50%) translateY(50%); }
  .bottom-sheet.is-full { transform: translateX(-50%) translateY(10%); }
  .bottom-sheet.is-open { transform: translateX(-50%) translateY(0); }
}
