/**
 * WP Realtime Chat — 새 메시지 알림 토스트 (화면 우측 상단)
 * 접두사 wprc-nt- 로 스코프. 테마·다른 플러그인과 충돌하지 않게 자체 리셋 포함.
 */

/* 스택: 우측 상단 고정.
   z-index 999997 — 플로팅 채팅(999999)·CODA(999998) 아래, 그 밖의 모든 것 위.
   (플로팅 버튼은 우하단이라 실제로 겹치지 않는다) */
#wprc-notify-stack {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 999997;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 340px;
    max-width: calc(100vw - 32px);
    pointer-events: none; /* 스택 자체는 클릭을 가로채지 않는다 */
}

/* 테마 전역 div/p 여백 규칙이 새어들지 않게 차단 (§6·§55-3) */
#wprc-notify-stack, #wprc-notify-stack * { margin: 0; padding: 0; box-sizing: border-box; }

.wprc-nt {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 12px 12px 14px !important;
    background: #ffffff;
    color: #1f2328;
    border: 1px solid #e3e6ea;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
    font-size: 14px;
    line-height: 1.45;
    cursor: pointer;
    opacity: 0;
    transform: translateX(24px);
    transition: opacity .22s ease, transform .22s ease;
}
.wprc-nt.wprc-nt-in   { opacity: 1; transform: translateX(0); }
.wprc-nt.wprc-nt-out  { opacity: 0; transform: translateX(24px); }
.wprc-nt:hover { box-shadow: 0 10px 28px rgba(0, 0, 0, .22); }

.wprc-nt-avatar {
    width: 36px; height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #e8eaed;
}
.wprc-nt-initial {
    width: 36px; height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: #1d9bf0;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
}

.wprc-nt-body { flex: 1 1 auto; min-width: 0; }

.wprc-nt-title {
    font-weight: 700;
    font-size: 14px;
    color: #1f2328;
    display: flex; align-items: center; gap: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wprc-nt-room {
    font-weight: 400;
    font-size: 12px;
    color: #6b7280;
    flex: 0 1 auto;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wprc-nt-text {
    margin-top: 2px !important;
    color: #4b5563;
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.wprc-nt-close {
    flex: 0 0 auto;
    width: 22px; height: 22px;
    border: 0; background: transparent;
    color: #9aa0a6;
    font-size: 17px; line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}
.wprc-nt-close:hover { background: #f1f3f4; color: #3c4043; }

/* 다크모드 (§39 sw-simple-dark-mode 의 body.dark-mode) */
body.dark-mode .wprc-nt {
    background: #23272e !important;
    color: #e8eaed !important;
    border-color: #3a3f47 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
body.dark-mode .wprc-nt-title  { color: #f1f3f4 !important; }
body.dark-mode .wprc-nt-text   { color: #c3c7cc !important; }
body.dark-mode .wprc-nt-room   { color: #9aa0a6 !important; }
body.dark-mode .wprc-nt-close  { color: #9aa0a6 !important; }
body.dark-mode .wprc-nt-close:hover { background: #33383f !important; color: #e8eaed !important; }
body.dark-mode .wprc-nt-avatar { background: #3a3f47; }

/* 모바일: 폭을 화면에 맞추고 상단 여백을 줄인다 */
@media (max-width: 600px) {
    #wprc-notify-stack {
        top: 10px; right: 10px; left: 10px;
        width: auto;
        max-width: none;
    }
    .wprc-nt { font-size: 13px; }
}

/* 관리바가 있으면 그만큼 내린다 */
body.admin-bar #wprc-notify-stack { top: 48px; }
@media (min-width: 783px) { body.admin-bar #wprc-notify-stack { top: 48px; } }

/* 모션 최소화 설정 존중 */
@media (prefers-reduced-motion: reduce) {
    .wprc-nt { transition: none; transform: none; }
    .wprc-nt.wprc-nt-out { transform: none; }
}
