/* 🔔 알림 화면·토스트 (js/site-notifications.js 가 그리는 하나의 컴포넌트, PC·모바일 공통 / 라이트·다크) */
.noti-mount {
  --noti-bg: #FFFFFF;
  --noti-bg-unread: #F4F8FF;
  --noti-line: #EEF0F3;
  --noti-text: #191F28;
  --noti-sub: #4E5968;
  --noti-mute: #8B95A1;
  --noti-chip: #F2F4F6;
  --noti-chip-active-bg: #191F28;
  --noti-chip-active-fg: #FFFFFF;
  --noti-blue: #3182F6;
  --noti-detail-bg: #F2F4F6;
  --noti-hover: rgba(0, 27, 55, 0.04);
  display: block;
  width: 100%;
  min-width: 0;
}
html.dark .noti-mount {
  --noti-bg: #1C1C24;
  --noti-bg-unread: rgba(49, 130, 246, 0.12);
  --noti-line: rgba(255, 255, 255, 0.07);
  --noti-text: #F2F4F6;
  --noti-sub: #B0B8C1;
  --noti-mute: #8B95A1;
  --noti-chip: #252632;
  --noti-chip-active-bg: #F2F4F6;
  --noti-chip-active-fg: #191F28;
  --noti-blue: #4F9BFF;
  --noti-detail-bg: rgba(255, 255, 255, 0.06);
  --noti-hover: rgba(255, 255, 255, 0.05);
}

/* 화면 머리줄 (알림 화면·마이페이지 공통) */
.noti-head { display: flex; align-items: center; gap: 4px; min-height: 52px; margin-bottom: 8px; }
.noti-head h2 { margin: 0 0 0 4px; font-size: 22px; font-weight: 900; letter-spacing: -0.02em; color: #191F28; }
html.dark .noti-head h2 { color: #FFFFFF; }
.noti-head-spacer { flex: 1; }
.noti-head-btn {
  width: 44px; height: 44px; border-radius: 9999px; display: inline-flex; align-items: center; justify-content: center;
  color: #6B7684; background: transparent; border: 0; cursor: pointer; transition: background .15s, transform .15s;
}
.noti-head-btn:hover { background: rgba(0, 27, 55, 0.05); color: #191F28; }
.noti-head-btn:active { transform: scale(0.92); }
html.dark .noti-head-btn { color: #B0B8C1; }
html.dark .noti-head-btn:hover { background: rgba(255, 255, 255, 0.08); color: #FFFFFF; }
.noti-head-btn svg { width: 22px; height: 22px; }
.noti-head-back { margin-left: -10px; }
.noti-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; margin-left: 8px;
  border-radius: 9999px; background: #F04452; color: #fff; font-size: 11px; font-weight: 900; line-height: 1;
}
.noti-count.hidden { display: none !important; }

.noti-feed { display: flex; flex-direction: column; gap: 0; min-height: 320px; }

/* 분류 칩 */
.noti-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.noti-chips::-webkit-scrollbar { display: none; }
.noti-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 9999px; border: 0;
  background: var(--noti-chip); color: var(--noti-sub); font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s, color .15s, transform .12s;
}
.noti-chip:active { transform: scale(0.96); }
.noti-chip.is-active { background: var(--noti-chip-active-bg); color: var(--noti-chip-active-fg); font-weight: 800; }
.noti-chip-n {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9999px; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  background: var(--noti-blue); color: #fff;
}
.noti-chip.is-active .noti-chip-n { background: var(--noti-chip-active-fg); color: var(--noti-chip-active-bg); }

/* 도구줄 */
.noti-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 0 2px; }
.noti-toolbar-text { font-size: 13px; color: var(--noti-mute); font-weight: 600; }
.noti-toolbar-text b { color: var(--noti-text); font-weight: 900; }
.noti-link {
  min-height: 44px; padding: 0 6px; border: 0; background: transparent; color: var(--noti-sub); font-size: 13px; font-weight: 700; cursor: pointer; border-radius: 10px;
}
.noti-link:hover { color: var(--noti-text); }
.noti-link:disabled { opacity: .4; cursor: default; }
.noti-link.is-danger:hover { color: #F04452; }

/* 날짜 묶음 */
.noti-group { margin-top: 4px; }
.noti-group-title { margin: 14px 2px 6px; font-size: 12px; font-weight: 800; color: var(--noti-mute); letter-spacing: 0; }

/* 알림 카드 */
.noti-card {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) 44px; align-items: start; gap: 12px;
  padding: 14px 4px 14px 14px; margin-bottom: 6px; border-radius: 16px; background: transparent; overflow: hidden;
  transition: background .15s, height .26s ease, opacity .22s ease, margin .26s ease, padding .26s ease, transform .26s ease;
}
.noti-card:hover { background: var(--noti-hover); }
.noti-card.is-unread { background: var(--noti-bg-unread); }
.noti-card.is-unread::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--noti-blue); }
.noti-card.is-read .noti-title { font-weight: 600; color: var(--noti-sub); }
.noti-card.is-leaving { height: 0 !important; opacity: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; transform: translateX(8px); pointer-events: none; }

.noti-ico { width: 40px; height: 40px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.noti-ico svg { width: 20px; height: 20px; }
.noti-ico[data-cat="activity"], .noti-tag[data-cat="activity"] { background: #E8F3FF; color: #3182F6; }
.noti-ico[data-cat="report"], .noti-tag[data-cat="report"] { background: #FFF1E6; color: #E05D00; }
.noti-ico[data-cat="benefit"], .noti-tag[data-cat="benefit"] { background: #E6F9F0; color: #0E9F6E; }
.noti-ico[data-cat="shopping"], .noti-tag[data-cat="shopping"] { background: #FEECEE; color: #F04452; }
.noti-ico[data-cat="notice"], .noti-tag[data-cat="notice"] { background: #F2F4F6; color: #4E5968; }
.noti-ico[data-cat="security"], .noti-tag[data-cat="security"] { background: #F3EDFF; color: #7B4FE0; }
html.dark .noti-ico[data-cat="activity"], html.dark .noti-tag[data-cat="activity"] { background: rgba(49, 130, 246, 0.18); color: #61A8FF; }
html.dark .noti-ico[data-cat="report"], html.dark .noti-tag[data-cat="report"] { background: rgba(245, 158, 11, 0.16); color: #FBA94C; }
html.dark .noti-ico[data-cat="benefit"], html.dark .noti-tag[data-cat="benefit"] { background: rgba(16, 185, 129, 0.16); color: #34D399; }
html.dark .noti-ico[data-cat="shopping"], html.dark .noti-tag[data-cat="shopping"] { background: rgba(240, 68, 82, 0.16); color: #FF7A85; }
html.dark .noti-ico[data-cat="notice"], html.dark .noti-tag[data-cat="notice"] { background: rgba(255, 255, 255, 0.08); color: #B0B8C1; }
html.dark .noti-ico[data-cat="security"], html.dark .noti-tag[data-cat="security"] { background: rgba(139, 92, 246, 0.2); color: #B79BFF; }

.noti-body { min-width: 0; }
.noti-main { display: block; width: 100%; text-align: left; padding: 0; border: 0; background: transparent; cursor: pointer; font: inherit; color: inherit; }
.noti-main:focus-visible, .noti-x:focus-visible, .noti-more:focus-visible, .noti-chip:focus-visible, .noti-link:focus-visible, .noti-read-toggle:focus-visible {
  outline: 2px solid var(--noti-blue); outline-offset: 2px;
}
.noti-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; min-height: 20px; }
.noti-dot { width: 7px; height: 7px; border-radius: 9999px; background: var(--noti-blue); flex: none; }
.noti-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.noti-time { font-size: 12px; color: var(--noti-mute); font-weight: 500; white-space: nowrap; }
.noti-title { display: block; font-size: 15px; line-height: 1.4; font-weight: 800; color: var(--noti-text); letter-spacing: -0.01em; word-break: keep-all; overflow-wrap: anywhere; }
.noti-msg {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 3px;
  font-size: 13.5px; line-height: 1.5; color: var(--noti-sub); word-break: keep-all; overflow-wrap: anywhere;
}
.noti-more { margin-top: 4px; min-height: 28px; padding: 0; border: 0; background: transparent; color: var(--noti-blue); font-size: 12.5px; font-weight: 700; cursor: pointer; }
.noti-detail { margin-top: 6px; padding: 10px 12px; border-radius: 12px; background: var(--noti-detail-bg); color: var(--noti-sub); font-size: 12.5px; line-height: 1.55; word-break: keep-all; overflow-wrap: anywhere; }
.noti-detail[hidden] { display: none; }
.noti-x {
  width: 44px; height: 44px; margin-top: -6px; border: 0; border-radius: 9999px; background: transparent; color: var(--noti-mute);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s, color .15s;
}
.noti-x svg { width: 16px; height: 16px; }
.noti-x:hover { background: rgba(240, 68, 82, 0.1); color: #F04452; }

/* 읽은 알림 */
.noti-read-wrap { margin-top: 12px; border-top: 1px solid var(--noti-line); }
.noti-read-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 52px; padding: 0 4px; border: 0; background: transparent;
  color: var(--noti-sub); font-size: 14px; font-weight: 700; cursor: pointer; text-align: left;
}
.noti-read-toggle small { margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--noti-mute); }
.noti-read-toggle svg { width: 18px; height: 18px; transition: transform .2s; }
.noti-read-toggle svg.is-open { transform: rotate(180deg); }
.noti-read-note { padding: 18px 4px 22px; font-size: 13px; color: var(--noti-mute); text-align: center; }
.noti-read-foot { display: flex; justify-content: center; padding: 6px 0 10px; }

/* 빈 상태 */
.noti-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 56px 20px 40px; min-height: 260px; }
.noti-empty svg { width: 56px; height: 56px; padding: 14px; border-radius: 20px; background: var(--noti-chip); color: var(--noti-blue); margin-bottom: 16px; box-sizing: border-box; }
.noti-empty-title { margin: 0; font-size: 16px; font-weight: 900; color: var(--noti-text); letter-spacing: -0.01em; }
.noti-empty-sub { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--noti-mute); max-width: 280px; word-break: keep-all; }
.noti-btn-primary { margin-top: 18px; min-height: 44px; padding: 0 22px; border: 0; border-radius: 12px; background: #3182F6; color: #fff; font-size: 14px; font-weight: 800; cursor: pointer; }
.noti-btn-primary:active { transform: scale(0.97); }

/* 로딩 스켈레톤 */
.noti-skel { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 14px; }
.noti-skel-ico, .noti-skel-lines i { display: block; background: var(--noti-chip); border-radius: 12px; animation: notiPulse 1.3s ease-in-out infinite; }
.noti-skel-ico { width: 40px; height: 40px; border-radius: 14px; }
.noti-skel-lines { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.noti-skel-lines i { height: 12px; width: 90%; }
.noti-skel-lines i:nth-child(1) { width: 38%; }
.noti-skel-lines i:nth-child(3) { width: 65%; }
@keyframes notiPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* PC: 가운데 열이 넓으니 카드를 조금 더 여유 있게 */
@media (min-width: 640px) {
  .noti-card { padding: 16px 6px 16px 16px; gap: 14px; }
  .noti-title { font-size: 15.5px; }
  .noti-msg { font-size: 14px; }
}

/* 새 알림 토스트 */
#site-noti-toast-container {
  position: fixed; top: max(10px, env(safe-area-inset-top, 10px)); left: 12px; right: 12px; z-index: 999999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
@media (min-width: 640px) { #site-noti-toast-container { left: auto; right: 24px; width: 380px; top: 20px; } }
.noti-toast {
  pointer-events: auto; display: grid; grid-template-columns: 40px minmax(0, 1fr) 32px; align-items: center; gap: 10px; padding: 10px 8px 10px 12px;
  border-radius: 18px; background: rgba(255, 255, 255, 0.96); border: 1px solid #E5E8EB; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); opacity: 0; transform: translateY(-12px) scale(0.97); transition: opacity .25s, transform .25s;
}
.noti-toast.is-in { opacity: 1; transform: none; }
html.dark .noti-toast { background: rgba(28, 28, 36, 0.96); border-color: rgba(255, 255, 255, 0.1); box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5); }
.noti-toast .noti-ico { width: 36px; height: 36px; border-radius: 12px; }
.noti-toast-main { display: flex; flex-direction: column; min-width: 0; text-align: left; border: 0; background: transparent; padding: 0; cursor: pointer; font: inherit; }
.noti-toast-tag { font-size: 11px; font-weight: 800; color: #3182F6; }
.noti-toast-title { font-size: 13.5px; font-weight: 800; color: #191F28; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.noti-toast-msg { font-size: 12px; color: #6B7684; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.dark .noti-toast-title { color: #F2F4F6; }
html.dark .noti-toast-msg { color: #B0B8C1; }
html.dark .noti-toast-tag { color: #61A8FF; }
.noti-toast-x { width: 32px; height: 32px; border: 0; border-radius: 9999px; background: transparent; color: #8B95A1; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.noti-toast-x svg { width: 14px; height: 14px; }

@media (prefers-reduced-motion: reduce) {
  .noti-card, .noti-toast, .noti-chip { transition: none; }
  .noti-skel-ico, .noti-skel-lines i { animation: none; }
}
