/* ==========================================================================
   HRBot — bottomSheet.css
   Vanilla bottom-sheet styles. Consumed by #applyLeaveModal,
   #reimbursementModal, #uploadDocModal.

   Markup shape (for reference — see components/bottomSheet.js for full
   contract):
     .bottom-sheet                  — root, fixed-positioned host of the panel + backdrop
       .bottom-sheet__backdrop      — fullscreen dim layer, closes on click
       .bottom-sheet__panel         — the sheet itself, anchored to the bottom
         .bottom-sheet__handle      — decorative drag-affordance bar
         .bottom-sheet__header      — title + close button row
         .bottom-sheet__body        — scrollable content area
         .bottom-sheet__footer      — optional footer row for actions

   All colors/radii/shadows come from base.css tokens.
   ========================================================================== */

/* ── Root + backdrop ──────────────────────────────────────────────────── */

.bottom-sheet {
  position: fixed;
  inset: 0;
  z-index: 1060; /* above bottom nav (1050) and the popup-overlay (1050) */
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none; /* the panel + backdrop re-enable themselves */
}

.bottom-sheet[hidden] {
  display: none;
}

.bottom-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: auto;
  cursor: pointer;
}

.bottom-sheet--open .bottom-sheet__backdrop {
  opacity: 1;
}

/* ── Panel ────────────────────────────────────────────────────────────── */

.bottom-sheet__panel {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: 85dvh;
  background: var(--color-surface);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  box-shadow: var(--shadow-popup);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;

  transform: translateY(100%);
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.bottom-sheet--open .bottom-sheet__panel {
  transform: translateY(0);
}

.bottom-sheet--closing .bottom-sheet__panel {
  transform: translateY(100%);
}

/* On desktop the sheet should feel like a sheet, not a full-screen panel —
   cap its width and centre it along the bottom edge. */
@media (min-width: 768px) {
  .bottom-sheet__panel {
    max-width: 480px;
    border-radius: var(--radius-xl);
    margin-bottom: 24px;
    /* Sits centred above the bottom nav, with a bit of breathing room */
  }
}

/* ── Handle (decorative drag affordance) ──────────────────────────────── */

.bottom-sheet__handle {
  width: 40px;
  height: 4px;
  background: var(--color-line);
  border-radius: var(--radius-pill);
  margin: 8px auto 4px;
  flex-shrink: 0;
}

/* ── Header ───────────────────────────────────────────────────────────── */

.bottom-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-line);
  flex-shrink: 0;
  background: var(--color-surface);
}

.bottom-sheet__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -0.01em;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-sheet__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-slate);
  font-size: 1.25rem;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.bottom-sheet__close:hover {
  background: var(--color-paper);
  color: var(--color-ink);
}

.bottom-sheet__close:focus-visible {
  outline: 2px solid var(--color-primary-mid);
  outline-offset: 2px;
}

/* ── Body ─────────────────────────────────────────────────────────────── */

.bottom-sheet__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--space-4);
  /* Bottom safe-area padding for iOS home indicator */
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

.bottom-sheet__body > :first-child {
  margin-top: 0;
}

.bottom-sheet__body > :last-child {
  margin-bottom: 0;
}

/* ── Footer (optional) ────────────────────────────────────────────────── */

.bottom-sheet__footer {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-4);
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--color-line);
  background: var(--color-surface);
}

/* ── Reduced motion ──────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .bottom-sheet__panel,
  .bottom-sheet__backdrop {
    transition: opacity 0.15s ease;
    transform: none;
  }
  .bottom-sheet--open .bottom-sheet__panel {
    transform: none;
  }
  .bottom-sheet--closing .bottom-sheet__panel {
    transform: none;
    opacity: 0;
  }
}
