/*
 * 알림 UI
 * Figma 시안(node 317:418) 기준: 틸(#49c4c4) 라운드 패널 + 흰 카드 + "더보기" 알약.
 *
 * 데스크톱/태블릿(≥769px): 우하단 플로팅 독 (글쓰기 FAB 바로 위)
 * 모바일(≤768px): 헤더 벨 아이콘 → /notifications 전체 페이지
 *   (모바일은 하단 탭바가 이미 5개라 탭을 늘리지 않고 헤더로 뺐다)
 */

:root {
    --notif-accent: #49c4c4;
    --notif-accent-dark: #3aacac;
    --notif-card: #ffffff;
    --notif-card-read: rgba(255, 255, 255, 0.55);
    --notif-text: #1a1a1a;
    --notif-text-sub: #5b6b7a;
    --notif-danger: #ef4444;
}

/* ==========================================================================
   공통: 벨 배지
   ========================================================================== */
.notif-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: var(--radius-sm, 4px);
    background: var(--notif-danger);
    color: #fff;
    font-family: var(--font-display);
    font-size: 12px;
    line-height: 1;
    letter-spacing: -0.02em;
}

.notif-badge[hidden] {
    display: none;
}

/* ==========================================================================
   데스크톱/태블릿: 우하단 플로팅 독
   ========================================================================== */
.notif-dock {
    position: fixed;
    /* 글쓰기 FAB(bottom 2rem, 56px)의 바로 위 */
    bottom: calc(2rem + 56px + 12px);
    right: 2rem;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

/* 접힌 상태: 벨 버튼 */
.notif-toggle {
    position: relative;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: var(--notif-accent);
    color: #143b3b;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.notif-toggle:hover {
    transform: translateY(-3px) scale(1.05);
    background: var(--notif-accent-dark);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.25);
}

.notif-toggle:active {
    transform: translateY(0) scale(0.98);
}

.notif-toggle .notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    box-shadow: 0 0 0 2px var(--bg-page, #d9d9d9);
}

/* 패널이 열려 있을 땐 토글 버튼을 감춘다 (패널 헤더가 같은 역할을 한다) */
.notif-dock.is-open .notif-toggle {
    display: none;
}

/* 펼친 상태: 틸 패널 */
.notif-panel {
    width: 384px;
    max-width: calc(100vw - 4rem);
    padding: 12px 20px 16px;
    border-radius: var(--radius-xl, 16px);
    background: var(--notif-accent);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28), 0 4px 10px rgba(0, 0, 0, 0.18);
    animation: notif-panel-in 0.18s ease-out;
}

.notif-panel[hidden] {
    display: none;
}

@keyframes notif-panel-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.notif-panel-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 2px 10px;
    color: #143b3b;
}

.notif-panel-icon {
    font-size: 20px;
}

.notif-panel-title {
    font-family: var(--font-display);
    font-size: 16px;
    color: #000;
}

.notif-panel-close {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #143b3b;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.notif-panel-close:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   알림 리스트 (패널·전체 페이지 공용)
   ========================================================================== */
.notif-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.notif-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    min-height: 40px;
    border-radius: var(--radius-xl, 16px);
    background: var(--notif-card);
    color: var(--notif-text);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.notif-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
    color: var(--notif-text);
}

/* 읽은 알림은 반투명 — 흰색(미읽음)과 자연스럽게 대비된다 */
.notif-item.is-read {
    background: var(--notif-card-read);
}

.notif-item-avatars {
    position: relative;
    display: flex;
    flex-shrink: 0;
    align-items: center;
}

.notif-item-avatars img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    background: #e9ecef;
}

/* 2~3명은 겹쳐서 스택 */
.notif-item-avatars img+img {
    margin-left: -10px;
}

/* 시스템 알림(액터 없음)은 타입 아이콘으로 대체 */
.notif-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(73, 196, 196, 0.18);
    color: #2b7a7a;
    font-size: 12px;
}

.notif-item-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.notif-item-text {
    font-family: var(--font-display);
    font-size: 15px;
    line-height: 1.35;
    color: #000;
    /* 제목이 길어도 카드가 무너지지 않게 한 줄 말줄임 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-item-sub {
    font-size: 12px;
    line-height: 1.3;
    color: var(--notif-text-sub);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 미읽음 점 */
.notif-item-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--notif-danger);
}

.notif-item.is-read .notif-item-dot {
    visibility: hidden;
}

/* 빈 상태 / 로딩 */
.notif-empty {
    padding: 22px 12px;
    border-radius: var(--radius-xl, 16px);
    background: var(--notif-card-read);
    color: #2f4f4f;
    font-size: 13px;
    text-align: center;
}

/* 더보기 알약 */
.notif-more {
    display: block;
    width: fit-content;
    margin: 12px auto 0;
    padding: 4px 18px;
    border: none;
    border-radius: 999px;
    background: #fff;
    color: #000;
    font-family: var(--font-display);
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.notif-more:hover {
    transform: translateY(-1px);
    color: #000;
}

/* ==========================================================================
   하단 탭바 알림 (모바일 전용)
   아이콘만 감싸는 래퍼라 배지가 라벨까지 밀어내지 않는다.
   ========================================================================== */
.bottom-tab-icon {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* 배지는 아이콘 오른쪽 위 모서리에 걸친다. 탭 폭이 좁으므로
   레이아웃에서 빠지도록 절대 배치한다. */
.bottom-tab-icon .notif-badge {
    position: absolute;
    top: -5px;
    left: 100%;
    margin-left: -7px;
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    font-size: 9px;
}

/* ==========================================================================
   알림 전체 페이지 (/notifications)
   ========================================================================== */
.notif-page {
    max-width: 720px;
    margin: 0 auto;
}

.notif-page-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.notif-page-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
}

.notif-page-actions {
    margin-left: auto;
}

.notif-read-all {
    padding: 6px 14px;
    border: 1px solid var(--border-medium);
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.notif-read-all:hover {
    background: var(--notif-accent);
    border-color: var(--notif-accent);
    color: #fff;
}

.notif-page-body {
    padding: 16px;
    border-radius: var(--radius-xl, 16px);
    background: var(--notif-accent);
}

.notif-page-more {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    border: none;
    border-radius: 999px;
    background: #fff;
    color: #000;
    font-family: var(--font-display);
    font-size: 14px;
    cursor: pointer;
}

.notif-page-more[hidden] {
    display: none;
}

/* ==========================================================================
   ≤768px 모바일: 플로팅 독 숨기고, 알림함은 화면 폭을 꽉 채운다
   ========================================================================== */
@media (max-width: 768px) {
    .notif-dock {
        display: none;
    }

    /* 좁은 화면에서 카드에 쓸 폭이 부족했다. main의 좌우 1rem 패딩을 음수 마진으로
       상쇄해 틸 프레임을 화면 끝까지 빼고, 안쪽 여백도 최소로 줄인다.
       머리말(알림 / 모두 읽음)은 본문 정렬을 따라 그대로 들여쓴 채 남긴다. */
    .notif-page-body {
        margin-inline: -1rem;
        padding: 12px 8px;
        border-radius: 0;
    }

    .notif-item-text {
        font-size: 14px;
    }
}

/* ==========================================================================
   다크 모드
   틸 패널과 흰 카드는 브랜드 색이라 그대로 유지한다 (다크에서도 대비 충분).
   페이지 셸 텍스트만 다크 토큰을 따른다.
   ========================================================================== */
[data-theme="dark"] .notif-toggle .notif-badge {
    box-shadow: 0 0 0 2px var(--bg-page, #121212);
}

[data-theme="dark"] .notif-read-all {
    color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {

    .notif-panel,
    .notif-item,
    .notif-toggle,
    .notif-more {
        animation: none;
        transition: none;
    }
}
