/* =========================================================
   Toast aksi (feedback PRG) — popup pojok kanan bawah.
   Sengaja BEDA dari notifikasi (lonceng) & alert inline validasi.
   Dipakai bersama: public / terapis / admin.
   ========================================================= */

.toast-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: #181715;
  color: #faf9f5;
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  box-shadow: 0 12px 40px rgba(20, 20, 19, 0.22);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.9rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast.is-in { opacity: 1; transform: translateY(0) scale(1); }
.toast.is-out { opacity: 0; transform: translateY(14px) scale(0.98); }

.toast__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.toast__icon svg { width: 16px; height: 16px; }
.toast--success .toast__icon { background: rgba(93, 184, 114, 0.18); color: #7dd69a; }
.toast--error   .toast__icon { background: rgba(198, 69, 69, 0.2);  color: #ff9b9b; }
.toast--warning .toast__icon { background: rgba(212, 160, 23, 0.2); color: #f2c94c; }
.toast--info    .toast__icon { background: rgba(204, 120, 92, 0.2); color: #e08b6e; }

.toast__msg { flex: 1; min-width: 0; padding-top: 1px; }

.toast__close {
  flex-shrink: 0;
  background: none;
  border: 0;
  color: rgba(250, 249, 245, 0.55);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.1rem;
  -webkit-tap-highlight-color: transparent;
}
.toast__close:hover { color: #faf9f5; }

@media (max-width: 480px) {
  .toast-stack { left: 1rem; right: 1rem; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity 0.01ms; }
}

/* ---------- Offline banner (shared) ---------- */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  padding-top: calc(0.55rem + env(safe-area-inset-top, 0px));
  background: #181715;
  color: #faf9f5;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 4px 18px rgba(20, 20, 19, 0.18);
  transform: translateY(0);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.offline-banner[hidden] {
  display: none !important;
}
.offline-banner__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f2c94c;
  box-shadow: 0 0 0 3px rgba(242, 201, 76, 0.2);
}
.offline-banner__text {
  max-width: 36rem;
}
/* Dorong konten sedikit saat banner aktif (hindari tutup header) */
html.is-offline body {
  padding-top: calc(2.4rem + env(safe-area-inset-top, 0px));
}
@media (max-width: 480px) {
  .offline-banner { font-size: 0.75rem; padding-left: 0.7rem; padding-right: 0.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .offline-banner { transition: none; }
}
