/* Overlay gaya iOS: bottom sheet, picker, roda tanggal, alert, dan toast — semuanya di atas latar blur. */
.backdrop {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--scrim);
  backdrop-filter: blur(14px) saturate(140%);
  animation: backdrop-in var(--duration) var(--ease) both;
}

.backdrop--center {
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
}

.backdrop.is-leaving {
  animation: backdrop-out 240ms var(--ease) both;
}

@keyframes backdrop-in {
  from {
    background: transparent;
    backdrop-filter: blur(0);
  }
}

@keyframes backdrop-out {
  to {
    background: transparent;
    backdrop-filter: blur(0);
  }
}

.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(100% - var(--safe-top) - var(--space-6));
  border: 1px solid var(--glass-border);
  border-bottom: 0;
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  animation: sheet-in var(--duration-push) var(--ease-ios) both;
  touch-action: pan-y;
}

.sheet--full {
  height: calc(100% - var(--safe-top) - var(--space-3));
}

.sheet--glass {
  background: var(--glass);
  backdrop-filter: var(--blur);
}

.is-leaving .sheet {
  animation: sheet-out 260ms var(--ease-ios) both;
}

@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}

@keyframes sheet-out {
  to {
    transform: translateY(100%);
  }
}

.sheet__handle {
  display: flex;
  flex: none;
  justify-content: center;
  padding: 10px 0 6px;
  cursor: grab;
  touch-action: none;
}

.sheet__grabber {
  width: 40px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--faint);
}

.sheet__head {
  display: flex;
  flex: none;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) var(--gutter) var(--space-3);
}

.sheet__titles {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sheet__title {
  font-size: var(--fs-xl);
  font-weight: 800;
  line-height: 1.25;
}

.sheet__subtitle {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.sheet__close {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--ink-2);
  background: var(--surface-sunken);
}

.sheet__body {
  flex: 1;
  min-height: 0;
  padding: var(--space-2) var(--gutter) var(--space-5);
  overflow: hidden auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

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

.sheet__footer {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3) var(--gutter) calc(var(--safe-bottom) + var(--space-3));
  border-top: 1px solid var(--hairline);
}

.sheet:not(:has(.sheet__footer)) .sheet__body {
  padding-bottom: calc(var(--safe-bottom) + var(--space-5));
}

/* Picker select: kartu kaca + tombol Batal terpisah, seperti action sheet iOS. */
.picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: calc(100% - var(--safe-top) - var(--space-6));
  padding: 0 var(--space-3) calc(var(--safe-bottom) + var(--space-3));
  animation: sheet-in var(--duration-push) var(--ease-ios) both;
}

.is-leaving .picker {
  animation: sheet-out 260ms var(--ease-ios) both;
}

.picker__card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  background: var(--glass);
  box-shadow: var(--shadow-float);
  backdrop-filter: var(--blur);
}

.picker__head {
  flex: none;
  padding: var(--space-4) var(--space-5) var(--space-3);
  border-bottom: 1px solid var(--hairline);
  text-align: center;
}

.picker__title {
  font-size: var(--fs-sm);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

.picker__message {
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.picker__search {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) var(--space-4) 0;
  padding: 0 var(--space-3);
  min-height: 40px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: var(--hairline);
}

.picker__search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  outline: 0;
}

.picker__list {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: var(--space-2) 0;
  overflow: hidden auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

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

.picker__option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 54px;
  padding: var(--space-2) var(--space-5);
  font-size: var(--fs-lg);
  font-weight: 600;
  text-align: left;
  transition: background-color var(--duration-fast) var(--ease);
}

.picker__option:active {
  background: var(--hairline);
}

.picker__option:disabled {
  color: var(--faint);
}

.picker__option[aria-selected="true"] {
  font-weight: 800;
  color: var(--gold);
}

.picker__option--danger {
  color: var(--danger);
}

.picker__option--center {
  justify-content: center;
  text-align: center;
}

.picker__label {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.picker__sub {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
}

.picker__empty {
  padding: var(--space-6);
  color: var(--muted);
  text-align: center;
}

.picker__cancel {
  flex: none;
  min-height: 56px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--gold);
  background: var(--surface);
  box-shadow: var(--shadow-float);
}

.picker__cancel:active {
  opacity: 0.8;
}

/* Roda tanggal. */
.wheel {
  position: relative;
  display: grid;
  grid-template-columns: 0.8fr 1.4fr 1fr;
  height: 220px;
  padding: 0 var(--space-4);
}

.wheel::before {
  position: absolute;
  top: 50%;
  right: var(--space-4);
  left: var(--space-4);
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--hairline);
  transform: translateY(-50%);
  pointer-events: none;
  content: "";
}

.wheel__column {
  height: 100%;
  padding: 88px 0;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  mask-image: linear-gradient(180deg, transparent 0%, #000 38%, #000 62%, transparent 100%);
}

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

.wheel__item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  font-size: var(--fs-xl);
  font-weight: 600;
  scroll-snap-align: center;
  font-variant-numeric: tabular-nums;
}

.wheel__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--hairline);
}

.wheel__action {
  min-height: 54px;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--ink-2);
}

.wheel__action + .wheel__action {
  border-left: 1px solid var(--hairline);
  font-weight: 800;
  color: var(--gold);
}

/* Alert iOS. */
.alert {
  width: 100%;
  max-width: 300px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  text-align: center;
  background: var(--glass);
  box-shadow: var(--shadow-float);
  backdrop-filter: var(--blur);
  animation: alert-in 260ms var(--ease-ios) both;
}

.is-leaving .alert {
  animation: alert-out 200ms var(--ease) both;
}

@keyframes alert-in {
  from {
    transform: scale(1.12);
    opacity: 0;
  }
}

@keyframes alert-out {
  to {
    transform: scale(0.96);
    opacity: 0;
  }
}

.alert__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-5) var(--space-5) var(--space-4);
}

.alert__title {
  font-size: var(--fs-lg);
  font-weight: 800;
}

.alert__message {
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.alert__actions {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  border-top: 1px solid var(--hairline-strong);
}

.alert__action {
  min-height: 48px;
  padding: 0 var(--space-2);
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--gold);
}

.alert__action + .alert__action {
  border-left: 1px solid var(--hairline-strong);
}

.alert__action--primary {
  font-weight: 800;
}

.alert__action--danger {
  font-weight: 800;
  color: var(--danger);
}

.alert__action:active {
  background: var(--hairline);
}

/* Toast: kapsul kaca di bawah Dynamic Island. */
.toast-region {
  position: absolute;
  top: calc(var(--safe-top) + var(--space-2));
  right: var(--space-4);
  left: var(--space-4);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
  min-height: 46px;
  padding: var(--space-2) var(--space-5) var(--space-2) var(--space-4);
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--on-onyx);
  background: rgb(23 20 15 / 88%);
  box-shadow: var(--shadow-float);
  backdrop-filter: var(--blur);
  animation: toast-in 420ms var(--ease-ios) both;
}

.toast .icon {
  color: #e2c987;
}

.toast--success .icon {
  color: #7bd6ad;
}

.toast--danger .icon {
  color: #f09a88;
}

.toast.is-leaving {
  animation: toast-out 260ms var(--ease) both;
}

@keyframes toast-in {
  from {
    transform: translateY(-140%) scale(0.92);
    opacity: 0;
  }
}

@keyframes toast-out {
  to {
    transform: translateY(-60%) scale(0.96);
    opacity: 0;
  }
}
