/* Dompet QU — Toaster (non-intrusive, semua portal) */

.dq-toast-wrap {
  --dq-toast-gap: .45rem;
  position: fixed;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  left: auto;
  top: auto;
  z-index: 280;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: var(--dq-toast-gap);
  width: min(22rem, calc(100vw - 2rem));
  max-width: min(22rem, calc(100vw - 2rem));
  margin: 0;
  padding: 0;
  pointer-events: none;
  box-sizing: border-box;
}

/* User mobile: di atas bottom nav agar tidak menutupi navigasi */
html[data-portal="user"] .dq-toast-wrap {
  bottom: calc(var(--dq-m-nav-h) + env(safe-area-inset-bottom, 0px) + .35rem);
}
@media (min-width: 768px) {
  html[data-portal="user"] .dq-toast-wrap {
    bottom: max(1.15rem, env(safe-area-inset-bottom, 0px));
  }
}

.dq-toast {
  --dq-toast-accent: #0ea5e9;
  --dq-toast-soft: rgba(14, 165, 233, .12);
  --dq-toast-ink: #0f172a;
  --dq-toast-muted: #64748b;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: .65rem .7rem;
  width: 100%;
  max-width: 100%;
  padding: .7rem .75rem .8rem;
  border-radius: 1rem;
  border: 1px solid rgba(226, 232, 240, .9);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96) 0%, rgba(248, 250, 252, .94) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .55) inset,
    0 14px 36px -18px rgba(15, 23, 42, .35),
    0 8px 18px -14px rgba(14, 165, 233, .28);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  color: var(--dq-toast-ink);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  pointer-events: auto;
  overflow: hidden;
  transform-origin: 90% 100%;
  animation: dqToastIn .28s cubic-bezier(.22, 1, .36, 1) both;
  box-sizing: border-box;
}

.dq-toast.is-out {
  animation: dqToastOut .2s ease forwards;
  pointer-events: none;
}

.dq-toast__icon {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: .65rem;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--dq-toast-soft);
  color: var(--dq-toast-accent);
  font-size: .95rem;
  line-height: 1;
  margin-top: .05rem;
}

.dq-toast__body {
  min-width: 0;
  padding-top: .1rem;
}

.dq-toast__label {
  display: block;
  margin: 0 0 .1rem;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dq-toast-accent);
  line-height: 1.2;
}

.dq-toast__msg {
  margin: 0;
  font-size: .8125rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--dq-toast-ink);
  word-break: break-word;
}

.dq-toast__close {
  width: 1.55rem;
  height: 1.55rem;
  margin: -.1rem -.1rem 0 0;
  border: 0;
  border-radius: .5rem;
  background: transparent;
  color: var(--dq-toast-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: .75rem;
  line-height: 1;
  transition: background .15s ease, color .15s ease;
  flex: 0 0 auto;
}
.dq-toast__close:hover {
  background: rgba(148, 163, 184, .16);
  color: var(--dq-toast-ink);
}
.dq-toast__close:focus-visible {
  outline: 2px solid rgba(14, 165, 233, .45);
  outline-offset: 1px;
}

.dq-toast__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(148, 163, 184, .18);
  overflow: hidden;
  pointer-events: none;
}
.dq-toast__bar > i {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--dq-toast-accent), #7dd3fc);
  animation: dqToastBar var(--dq-toast-ms, 3.2s) linear forwards;
}
.dq-toast.is-ok .dq-toast__bar > i {
  background: linear-gradient(90deg, #059669, #6ee7b7);
}
.dq-toast.is-err .dq-toast__bar > i {
  background: linear-gradient(90deg, #e11d48, #fda4af);
}
.dq-toast.is-warn .dq-toast__bar > i {
  background: linear-gradient(90deg, #d97706, #fcd34d);
}
.dq-toast.is-paused .dq-toast__bar > i {
  animation-play-state: paused;
}

/* Types */
.dq-toast.is-ok {
  --dq-toast-accent: #059669;
  --dq-toast-soft: rgba(16, 185, 129, .14);
  border-color: rgba(167, 243, 208, .85);
}
.dq-toast.is-err {
  --dq-toast-accent: #e11d48;
  --dq-toast-soft: rgba(244, 63, 94, .12);
  border-color: rgba(254, 202, 202, .9);
}
.dq-toast.is-warn {
  --dq-toast-accent: #d97706;
  --dq-toast-soft: rgba(245, 158, 11, .14);
  border-color: rgba(253, 230, 138, .9);
}
.dq-toast.is-info {
  --dq-toast-accent: #0284c7;
  --dq-toast-soft: rgba(14, 165, 233, .14);
  border-color: rgba(186, 230, 253, .95);
}

@keyframes dqToastIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes dqToastOut {
  to {
    opacity: 0;
    transform: translateY(8px) scale(.96);
  }
}
@keyframes dqToastBar {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* Dark */
html[data-theme="dark"] .dq-toast {
  --dq-toast-ink: #e2e8f0;
  --dq-toast-muted: #94a3b8;
  border-color: #243447;
  background: linear-gradient(180deg, rgba(22, 36, 52, .96) 0%, rgba(15, 27, 42, .96) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .03) inset,
    0 18px 40px -20px rgba(0, 0, 0, .65);
}
html[data-theme="dark"] .dq-toast__close:hover {
  background: rgba(148, 163, 184, .12);
  color: #e2e8f0;
}
html[data-theme="dark"] .dq-toast__bar {
  background: rgba(51, 65, 85, .55);
}
html[data-theme="dark"] .dq-toast.is-ok { border-color: rgba(6, 95, 70, .55); }
html[data-theme="dark"] .dq-toast.is-err { border-color: rgba(159, 18, 57, .55); }
html[data-theme="dark"] .dq-toast.is-warn { border-color: rgba(146, 64, 14, .5); }
html[data-theme="dark"] .dq-toast.is-info { border-color: rgba(3, 105, 161, .5); }

@media (max-width: 480px) {
  .dq-toast-wrap {
    right: max(.75rem, env(safe-area-inset-right, 0px));
    left: max(.75rem, env(safe-area-inset-left, 0px));
    width: auto;
    max-width: none;
    align-items: stretch;
  }
  .dq-toast {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dq-toast,
  .dq-toast.is-out,
  .dq-toast__bar > i {
    animation: none !important;
  }
  .dq-toast.is-out { opacity: 0; }
}
