/**
 * 用户中心公告栏样式
 * 支持上下滚动切换公告
 */

/* 公告栏主容器 */
.user-announcement-bar {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fcd34d;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.15);
    overflow: hidden;
}

/* 公告图标 */
.announcement-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.announcement-icon i {
    color: #fff;
    font-size: 16px;
}

/* 滚动区域容器 */
.announcement-scroll-wrapper {
    flex: 1;
    height: 32px;
    overflow: hidden;
    position: relative;
    mask-image: linear-gradient(to bottom, transparent 0%, black 20%, black 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 20%, black 80%, transparent 100%);
}

/* 滚动内容 */
.announcement-scroll-content {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 单条公告 */
.announcement-item {
    height: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
    white-space: nowrap;
    overflow: hidden;
}

/* 公告标签 */
.announcement-tag {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.tag-urgent {
    background: #ef4444;
    color: #fff;
}

.tag-important {
    background: #f97316;
    color: #fff;
}

/* 公告标题 */
.announcement-title-text {
    font-weight: 600;
    color: #92400e;
    font-size: 14px;
    flex-shrink: 0;
}

/* 公告内容（支持HTML） */
.announcement-content-html {
    color: #78350f;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.announcement-content-html a {
    color: #d97706;
    text-decoration: underline;
}

.announcement-content-html a:hover {
    color: #b45309;
}

.announcement-content-html p {
    margin: 0;
    display: inline;
}

.announcement-content-html br {
    display: none;
}

/* 导航控制区 */
.announcement-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    flex-shrink: 0;
}

.nav-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #92400e;
}

.nav-btn:hover {
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-btn i {
    font-size: 12px;
}

/* 指示器 */
.nav-indicator {
    font-size: 12px;
    color: #92400e;
    font-weight: 500;
    min-width: 36px;
    text-align: center;
}

/* 自动滚动动画 */
@keyframes announcementAutoScroll {
    0%, 25% {
        transform: translateY(0);
    }
    33%, 58% {
        transform: translateY(-32px);
    }
    66%, 91% {
        transform: translateY(-64px);
    }
    100% {
        transform: translateY(0);
    }
}

/* 点击提示 */
.announcement-click-hint {
    margin-left: auto;
    font-size: 11px;
    color: #d97706;
    opacity: 0.7;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

.announcement-item:hover .announcement-click-hint {
    opacity: 1;
}

.announcement-scroll-wrapper {
    cursor: pointer;
}

/* 隐藏状态 */
.user-announcement-bar.hidden {
    display: none;
}

/* 不同类型的公告栏背景色 */
.user-announcement-bar.type-normal {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #fcd34d;
}

.user-announcement-bar.type-important {
    background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
    border-color: #fdba74;
}

.user-announcement-bar.type-urgent {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #fca5a5;
}

/* ============================================
 * 响应式设计 - 手机端优化
 * ============================================ */

@media (max-width: 768px) {
    .user-announcement-bar {
        padding: 10px 12px;
        margin-bottom: 16px;
    }

    .announcement-icon {
        width: 32px;
        height: 32px;
        margin-right: 10px;
    }

    .announcement-icon i {
        font-size: 14px;
    }

    .announcement-scroll-wrapper {
        height: 28px;
    }

    .announcement-item {
        height: 28px;
    }

    .announcement-tag {
        padding: 1px 6px;
        font-size: 10px;
    }

    .announcement-title-text {
        font-size: 13px;
    }

    .announcement-content-html {
        font-size: 12px;
    }

    .announcement-nav {
        margin-left: 8px;
        gap: 4px;
    }

    .nav-btn {
        width: 24px;
        height: 24px;
    }

    .nav-indicator {
        font-size: 11px;
        min-width: 32px;
    }

    .announcement-click-hint {
        display: none;
    }
}

@media (max-width: 400px) {
    .announcement-content-html {
        display: none;
    }
}

/* ============================================
 * 公告详情弹窗样式
 * ============================================ */

/* 弹窗遮罩层 */
.announcement-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px;
}

.announcement-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 弹窗容器 */
.announcement-modal {
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(245, 158, 11, 0.2);
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.8) translateY(40px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    border: 1px solid rgba(252, 211, 77, 0.3);
}

.announcement-modal-overlay.active .announcement-modal {
    transform: scale(1) translateY(0);
}

/* 弹窗头部 */
.announcement-modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px 28px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 50%, #fcd34d 100%);
    border-bottom: 2px solid #fbbf24;
    position: relative;
    flex-shrink: 0;
}

.announcement-modal-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #f59e0b, transparent);
}

.modal-header-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.modal-header-icon i {
    color: #fff;
    font-size: 20px;
}

.modal-title {
    flex: 1;
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #78350f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #92400e;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modal-close:hover {
    background: #fff;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-close i {
    font-size: 16px;
}

/* 弹窗内容区 - 可上下滚动，移除box-shadow */
.announcement-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    background: #fff;
    scroll-behavior: smooth;
    box-shadow: none !important;
}

/* 自定义滚动条 */
.announcement-modal-body::-webkit-scrollbar {
    width: 8px;
}

.announcement-modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.announcement-modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #fcd34d, #fbbf24);
    border-radius: 4px;
}

.announcement-modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #fbbf24, #f59e0b);
}

/* 类型标签 */
.modal-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.modal-type-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.modal-type-badge.type-normal {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0369a1;
}

.modal-type-badge.type-important {
    background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
    color: #c2410c;
}

.modal-type-badge.type-urgent {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    animation: urgentPulse 1.5s ease-in-out infinite;
}

@keyframes urgentPulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 2px 16px rgba(239, 68, 68, 0.5); }
}

/* 弹窗内容 - 移除box-shadow */
.modal-content {
    color: #374151;
    font-size: 15px;
    line-height: 1.9;
    box-shadow: none !important;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.modal-content p {
    margin: 0 0 16px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.modal-content p:last-child {
    margin-bottom: 0;
}

.modal-content a {
    color: #d97706;
    text-decoration: none;
    border-bottom: 2px solid #fcd34d;
    transition: color 0.2s ease;
    font-weight: 500;
}

.modal-content a:hover {
    color: #b45309;
    border-bottom-color: #f59e0b;
}

.modal-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 16px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.modal-content ul,
.modal-content ol {
    margin: 16px 0;
    padding-left: 28px;
}

.modal-content li {
    margin-bottom: 8px;
}

.modal-content h1,
.modal-content h2,
.modal-content h3,
.modal-content h4,
.modal-content h5,
.modal-content h6 {
    color: #111827;
    margin: 24px 0 16px 0;
    font-weight: 700;
}

.modal-content h1 { font-size: 24px; }
.modal-content h2 { font-size: 20px; }
.modal-content h3 { font-size: 18px; }

.modal-content blockquote {
    border-left: 4px solid #fbbf24;
    margin: 20px 0;
    padding: 16px 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
    border-radius: 0 12px 12px 0;
    font-style: italic;
}

.modal-content code {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    color: #374151;
    border: 1px solid #d1d5db;
}

.modal-content pre {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: #f9fafb;
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 20px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.modal-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    border: none;
}

.modal-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.modal-content th,
.modal-content td {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.modal-content th {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    font-weight: 600;
}

.modal-content tr:last-child td {
    border-bottom: none;
}

.modal-content tr:hover td {
    background: #f9fafb;
}

/* 弹窗底部 */
.announcement-modal-footer {
    padding: 20px 28px;
    background: linear-gradient(180deg, #fafafa 0%, #f3f4f6 100%);
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.modal-btn {
    padding: 14px 48px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn-primary {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.5);
}

.modal-btn-primary:active {
    transform: translateY(0);
}

/* ============================================
 * 响应式弹窗 - 手机端优化
 * ============================================ */

@media (max-width: 640px) {
    .announcement-modal-overlay {
        padding: 10px;
        align-items: center;
    }

    .announcement-modal {
        max-height: 85vh;
        border-radius: 16px;
        transform: scale(0.8) translateY(40px);
        max-width: 100%;
        width: 100%;
    }

    .announcement-modal-overlay.active .announcement-modal {
        transform: scale(1) translateY(0);
    }

    .announcement-modal-header {
        padding: 16px 20px;
        border-radius: 16px 16px 0 0;
        flex-shrink: 0;
        min-height: 60px;
    }

    .modal-header-icon {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .modal-header-icon i {
        font-size: 16px;
    }

    .modal-title {
        font-size: 16px;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .modal-close {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
    }

    .announcement-modal-body {
        padding: 20px;
        max-height: calc(85vh - 160px);
    }

    .modal-content {
        font-size: 14px;
    }

    .modal-content h1 { font-size: 20px; }
    .modal-content h2 { font-size: 18px; }
    .modal-content h3 { font-size: 16px; }

    .announcement-modal-footer {
        padding: 14px 20px;
        flex-shrink: 0;
    }

    .modal-btn {
        width: 100%;
        padding: 14px 24px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .announcement-modal-overlay {
        padding: 8px;
    }

    .announcement-modal {
        border-radius: 12px;
        max-height: 85vh;
        width: 100%;
    }

    .announcement-modal-header {
        padding: 14px 16px;
        min-height: 56px;
    }

    .modal-header-icon {
        width: 32px;
        height: 32px;
    }

    .modal-header-icon i {
        font-size: 14px;
    }

    .modal-title {
        font-size: 15px;
    }

    .modal-close {
        width: 30px;
        height: 30px;
    }

    .announcement-modal-body {
        padding: 16px;
        max-height: calc(85vh - 150px);
    }

    .modal-content {
        font-size: 14px;
        line-height: 1.7;
    }

    .modal-content img {
        border-radius: 8px;
    }

    .modal-type-badge {
        padding: 4px 10px;
        font-size: 11px;
        margin-bottom: 12px;
    }

    .announcement-modal-footer {
        padding: 12px 16px;
    }

    .modal-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* 弹窗滚动提示 */
.modal-scroll-hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.modal-scroll-hint.show {
    opacity: 1;
}

.modal-scroll-hint i {
    margin-right: 6px;
    animation: bounceDown 1s ease-in-out infinite;
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}
