/* 通知系統樣式 */

/* 通知容器 */
.xn-notification {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0 15px;
}

/* 通知按鈕 */
.xn-notification-button {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.xn-notification-button:hover {
    background-color: var(--hover-bg-color, rgba(0, 0, 0, 0.05));
}

.xn-notification-button i {
    font-size: 18px;
    color: var(--text-color, #333);
}

/* 通知徽章（未讀數量） */
.xn-notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: #ff4444;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 通知下拉選單 */
.xn-notification-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--dropdown-bg, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 380px;
    max-height: 500px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.xn-notification-dropdown.active {
    display: block;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 通知下拉內容 */
.xn-notification-dropdown-content {
    display: flex;
    flex-direction: column;
    max-height: 500px;
}

/* 通知標題區域 */
.xn-notification-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.xn-notification-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color, #333);
}

.xn-mark-all-read {
    background: none;
    border: none;
    color: #007bff;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.xn-mark-all-read:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

.xn-mark-all-read:disabled {
    color: #999;
    cursor: not-allowed;
}

/* 分隔線 */
.xn-notification-divider {
    flex-shrink: 0;
    margin: 0;
    border: none;
    border-top: 1px solid var(--border-color, #e0e0e0);
}

/* 通知列表 */
.xn-notification-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* 自定義滾動條 */
.xn-notification-list::-webkit-scrollbar {
    width: 6px;
}

.xn-notification-list::-webkit-scrollbar-track {
    background: var(--scrollbar-track, #f1f1f1);
}

.xn-notification-list::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb, #888);
    border-radius: 3px;
}

.xn-notification-list::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover, #555);
}

/* 通知項目 */
.xn-notification-item {
    display: flex;
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-left: 3px solid transparent;
}

.xn-notification-item:hover {
    background-color: var(--hover-bg-color, rgba(0, 0, 0, 0.03));
}

.xn-notification-item.unread {
    background-color: rgba(0, 123, 255, 0.05);
    border-left-color: #007bff;
}

.xn-notification-item.unread:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

/* 通知圖標 */
.xn-notification-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 12px;
    font-size: 18px;
}

.xn-notification-icon.info {
    background-color: rgba(0, 123, 255, 0.1);
    color: #007bff;
}

.xn-notification-icon.warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.xn-notification-icon.error {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.xn-notification-icon.success {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

/* 通知內容 */
.xn-notification-content {
    flex: 1;
    min-width: 0;
}

.xn-notification-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color, #333);
    margin: 0 0 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xn-notification-message {
    font-size: 13px;
    color: var(--text-secondary, #666);
    margin: 0 0 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xn-notification-time {
    font-size: 12px;
    color: var(--text-muted, #999);
}

/* 空狀態 */
.xn-notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted, #999);
}

.xn-notification-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.xn-notification-empty p {
    margin: 0;
    font-size: 14px;
}

/* 通知底部 */
.xn-notification-footer {
    flex-shrink: 0;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color, #e0e0e0);
    background-color: var(--dropdown-bg, #fff);
}

.xn-view-all {
    width: 100%;
    background: none;
    border: none;
    color: #007bff;
    font-size: 14px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.xn-view-all:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

/* Dark Mode 支援 */
[data-theme="dark"] .xn-notification-button i {
    color: #fff;
}

[data-theme="dark"] .xn-notification-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .xn-notification-dropdown {
    background: #2d2d2d;
    border-color: #444;
}

[data-theme="dark"] .xn-notification-header h3 {
    color: #fff;
}

[data-theme="dark"] .xn-notification-divider {
    border-top-color: #444;
}

[data-theme="dark"] .xn-notification-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .xn-notification-item.unread:hover {
    background-color: rgba(0, 123, 255, 0.15);
}

[data-theme="dark"] .xn-notification-title {
    color: #fff;
}

[data-theme="dark"] .xn-notification-message {
    color: #ccc;
}

[data-theme="dark"] .xn-notification-time {
    color: #888;
}

[data-theme="dark"] .xn-notification-empty {
    color: #888;
}

/* 響應式設計 */
@media screen and (max-width: 768px) {
    .xn-notification {
        margin: 0 10px;
    }

    .xn-notification-dropdown {
        position: fixed;
        top: 60px !important;
        left: 10px;
        right: 10px;
        width: auto;
        max-height: calc(100vh - 120px);
    }

    .xn-notification-list {
        max-height: calc(100vh - 240px);
    }

    .xn-notification-header {
        padding: 12px 15px;
    }

    .xn-notification-header h3 {
        font-size: 15px;
    }

    .xn-mark-all-read {
        font-size: 12px;
    }

    .xn-notification-item {
        padding: 10px 15px;
    }

    .xn-notification-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
        margin-right: 10px;
    }

    .xn-notification-title {
        font-size: 13px;
    }

    .xn-notification-message {
        font-size: 12px;
    }

    .xn-notification-time {
        font-size: 11px;
    }

    .xn-notification-footer {
        padding: 10px 15px;
    }

    .xn-view-all {
        font-size: 13px;
    }
}

@media screen and (max-width: 480px) {
    .xn-notification-button {
        padding: 6px;
    }

    .xn-notification-button i {
        font-size: 16px;
    }

    .xn-notification-badge {
        font-size: 9px;
        min-width: 16px;
        height: 16px;
    }

    .xn-notification-dropdown {
        top: 55px !important;
        left: 5px;
        right: 5px;
    }
}
