/* =====================================================================
   알림 표시 두 가지
   ---------------------------------------------------------------------
   1) 토스트 (.hb-toast)     — 우측 하단. "저장했어요" 같은 순간 안내.
                               잠깐 떴다가 스스로 사라진다.
   2) 고정 알림 (.hb-notice) — 우측 상단. 공지·초대·작업 완료처럼 놓치면 안 되는 것.
                               사용자가 닫을 때까지 페이지를 옮겨도 계속 따라다닌다.

   둘을 다른 자리에 두는 이유: 하나는 흘려보내도 되는 것이고, 하나는 반드시 봐야 하는
   것이라 같은 자리에서 섞이면 중요한 게 순간 안내에 묻힌다.
   ===================================================================== */

/* ── 1. 토스트: 우측 하단에서 스르륵 ────────────────────────────────── */
.hb-toast-stack {
  position: fixed;
  right: calc(20px + var(--safe-right, 0px));
  bottom: calc(20px + var(--safe-bottom, 0px));
  z-index: 320;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.hb-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 13px 16px;
  border-radius: var(--radius);
  background: #0f172a;
  color: #f8fafc;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
  pointer-events: auto;
  /* 오른쪽 밖에서 들어왔다가 다시 오른쪽으로 빠진다 */
  transform: translateX(calc(100% + 28px));
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}

.hb-toast.is-shown {
  transform: translateX(0);
  opacity: 1;
}

.hb-toast__icon {
  flex: 0 0 auto;
  font-size: 15px;
  line-height: 1.4;
}

.hb-toast--success { background: #14532d; }
.hb-toast--error { background: #7f1d1d; }

/* ── 2. 고정 알림: 우측 상단, 닫을 때까지 유지 ──────────────────────── */
.hb-notice-stack {
  position: fixed;
  right: calc(20px + var(--safe-right, 0px));
  /* 고정 헤더 아래로 붙인다(--header-h 는 header.js 가 실측값으로 갱신) */
  top: calc(var(--header-h, 64px) + 12px + var(--safe-top, 0px));
  z-index: 210;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(340px, calc(100vw - 40px));
  max-height: calc(100dvh - var(--header-h, 64px) - 40px);
  overflow-y: auto;
  pointer-events: none;
}

.hb-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  background: var(--card, #fff);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  pointer-events: auto;
  transform: translateX(calc(100% + 28px));
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}

.hb-notice.is-shown {
  transform: translateX(0);
  opacity: 1;
}

/* 공지처럼 더 강한 알림 */
.hb-notice--critical {
  border-left-color: var(--danger, #ef4444);
  background: #fff7f7;
}

.hb-notice__icon {
  flex: 0 0 auto;
  font-size: 17px;
  line-height: 1.3;
}

.hb-notice__body {
  flex: 1 1 auto;
  min-width: 0;
}

.hb-notice__title {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.45;
}

.hb-notice__message {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  word-break: break-word;
}

.hb-notice__meta {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.hb-notice__link {
  display: inline-block;
  margin-top: 8px;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.hb-notice__link:hover { text-decoration: underline; }

.hb-notice__close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.hb-notice__close:hover {
  background: rgba(148, 163, 184, 0.16);
  color: var(--text);
}

/* 여러 건이 쌓였을 때 한 번에 정리 */
.hb-notice-clear {
  align-self: flex-end;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card, #fff);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.hb-notice-clear:hover { color: var(--text); }

@media (max-width: 480px) {
  .hb-toast-stack,
  .hb-notice-stack {
    right: 12px;
    left: 12px;
    width: auto;
  }
  .hb-toast { max-width: none; width: 100%; }
}
