/* ========================================
   通知鈴鐺樣式
   ======================================== */

/* 鈴鐺容器 */
.notification-bell-wrapper {
    position: relative;
    margin-right: 12px;
    z-index: 9500;
}

/* 鈴鐺按鈕 */
.notification-bell-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-text-muted, #6b7280);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 9501;
}

.notification-bell-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    color: var(--color-primary, #3b82f6);
    transform: scale(1.05);
}

.notification-bell-btn:hover svg {
    animation: bellRing 0.5s ease;
}

@keyframes bellRing {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(15deg); }
    40% { transform: rotate(-15deg); }
    60% { transform: rotate(10deg); }
    80% { transform: rotate(-10deg); }
}

/* 未讀數量徽章 */
.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* 下拉選單 */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 380px;
    max-height: 500px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: none;
    overflow: hidden;
    isolation: isolate;
}

.notification-dropdown.is-open {
    display: block;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 下拉選單標題 */
.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-header, #f9fafb);
}

.notification-dropdown-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
}

.btn-mark-all-read {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted, #9ca3af);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-mark-all-read:hover {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

/* 下拉選單內容 */
.notification-dropdown-body {
    max-height: 360px;
    overflow-y: auto;
}

/* 通知項目 */
.notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.notification-item:hover {
    background: var(--bg-hover, #f3f4f6);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.is-unread {
    background: rgba(59, 130, 246, 0.05);
}

.notification-item.is-unread::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: #3b82f6;
    border-radius: 50%;
}

/* 通知圖示 */
.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.type-comment {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
}

.notification-icon.type-follow {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
}

.notification-icon.type-like {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.notification-icon.type-work {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.notification-icon.type-system {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: #fff;
}

/* 通知內容 */
.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-message {
    font-size: 0.85rem;
    color: var(--text-secondary, #6b7280);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
    margin-top: 4px;
}

/* 空狀態 */
.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted, #9ca3af);
}

.notification-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.notification-empty p {
    margin: 0;
    font-size: 0.9rem;
}

/* 下拉選單底部 */
.notification-dropdown-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-header, #f9fafb);
    text-align: center;
}

.btn-view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary, #3b82f6);
    text-decoration: none;
    transition: color 0.2s ease;
}

.btn-view-all:hover {
    color: var(--primary-hover, #2563eb);
}

/* ========== 深色模式 ========== */
:root[data-theme="dark"] .notification-bell-btn {
    background: rgba(56, 189, 248, 0.15);
    color: #94a3b8;
}

:root[data-theme="dark"] .notification-bell-btn:hover {
    background: rgba(56, 189, 248, 0.25);
    color: #38bdf8;
}

:root[data-theme="dark"] .notification-dropdown {
    position: absolute;
    background: rgba(30, 41, 59, 0.98);
    border-color: rgba(71, 85, 105, 0.5);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

:root[data-theme="dark"] .notification-dropdown-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(71, 85, 105, 0.4);
}

:root[data-theme="dark"] .notification-dropdown-header h4 {
    color: #f1f5f9;
}

:root[data-theme="dark"] .notification-item {
    border-color: rgba(71, 85, 105, 0.3);
}

:root[data-theme="dark"] .notification-item:hover {
    background: rgba(51, 65, 85, 0.5);
}

:root[data-theme="dark"] .notification-item.is-unread {
    background: rgba(59, 130, 246, 0.1);
}

:root[data-theme="dark"] .notification-title {
    color: #f1f5f9;
}

:root[data-theme="dark"] .notification-message {
    color: #94a3b8;
}

:root[data-theme="dark"] .notification-time {
    color: #64748b;
}

:root[data-theme="dark"] .notification-dropdown-footer {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(71, 85, 105, 0.4);
}

:root[data-theme="dark"] .btn-view-all {
    color: #60a5fa;
}

:root[data-theme="dark"] .btn-view-all:hover {
    color: #93c5fd;
}

:root[data-theme="dark"] .btn-mark-all-read:hover {
    background: rgba(34, 197, 94, 0.15);
}

/* ========== RWD ========== */
@media (max-width: 480px) {
    .notification-dropdown {
        width: calc(100vw - 32px);
        right: -60px;
    }
}
/* 通知下拉選單強制最高層，避免被頁面內容壓住 */
#notificationDropdown,
.notification-dropdown {
    z-index: 1000000 !important;
}
