/* ========================================
   公告系统样式
   ======================================== */

/* 公告按钮 - 导航栏中，与 .user-btn 风格统一 */
.announcement-btn {
    position: relative;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
    background: var(--primary-bg, #eff6ff);
    border: none;
    border-radius: var(--radius-md, 10px);
    color: var(--primary-color, #3b82f6);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.9rem;
}

.announcement-btn:hover {
    background: var(--primary-color, #3b82f6);
    color: white;
}

.announcement-btn i {
    font-size: 1rem;
}

/* 未读红点 */
.announcement-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 9px;
    height: 9px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    display: none;
}

.announcement-btn .badge.show {
    display: block;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

/* 公告面板 */
.announcement-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.announcement-panel.open {
    transform: translateX(0);
}

.announcement-panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.announcement-panel-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.announcement-panel-header h3 i {
    color: #3b82f6;
}

.announcement-panel-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.announcement-panel-close:hover {
    background: #ef4444;
    color: white;
}

.announcement-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* 公告卡片 */
.announcement-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s;
    cursor: pointer;
}

.announcement-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.1);
}

.announcement-card.type-warning {
    border-left: 3px solid #f59e0b;
}

.announcement-card.type-important {
    border-left: 3px solid #ef4444;
}

.announcement-card.type-info {
    border-left: 3px solid #3b82f6;
}

.announcement-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.announcement-type-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.announcement-type-tag.info {
    background: #dbeafe;
    color: #1d4ed8;
}

.announcement-type-tag.warning {
    background: #fef3c7;
    color: #92400e;
}

.announcement-type-tag.important {
    background: #fee2e2;
    color: #991b1b;
}

.announcement-pinned {
    font-size: 11px;
    color: #f59e0b;
}

.announcement-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
    line-height: 1.4;
}

.announcement-card-content {
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.announcement-card-content.expanded {
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
}

.announcement-card-time {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 8px;
}

/* 空状态 */
.announcement-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.announcement-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.announcement-empty p {
    font-size: 14px;
}

/* 遮罩层 */
.announcement-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.announcement-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 重要公告弹窗 */
.announcement-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.announcement-popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

.announcement-popup {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    transform: scale(0.9) translateY(20px);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.announcement-popup-overlay.show .announcement-popup {
    transform: scale(1) translateY(0);
}

.announcement-popup-header {
    padding: 24px 24px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.announcement-popup-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    flex: 1;
    padding-right: 16px;
}

.announcement-popup-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
    margin-bottom: 8px;
}

.announcement-popup-type.important {
    background: #fee2e2;
    color: #dc2626;
}

.announcement-popup-type.warning {
    background: #fef3c7;
    color: #d97706;
}

.announcement-popup-type.info {
    background: #dbeafe;
    color: #2563eb;
}

.announcement-popup-body {
    padding: 16px 24px 24px;
    font-size: 14px;
    line-height: 1.8;
    color: #475569;
    white-space: pre-wrap;
}

.announcement-popup-footer {
    padding: 0 24px 24px;
    display: flex;
    justify-content: flex-end;
}

.announcement-popup-close-btn {
    padding: 10px 24px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.announcement-popup-close-btn:hover {
    background: #2563eb;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .announcement-panel {
        width: 100%;
        max-width: 100vw;
    }

    .announcement-popup {
        width: 95%;
        max-height: 85vh;
    }
}

/* 与 .user-btn 同步的响应式断点 */
@media (max-width: 1200px) {

    /* 小屏隐藏文字，只保留图标，与user-btn一致 */
    .announcement-btn {
        padding: 0.5rem;
        gap: 0;
    }

    .announcement-btn .ann-text {
        display: none;
    }

    .announcement-btn i {
        font-size: 1rem;
    }
}