/* ================== 全局 ================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fafbfc;
    color: #1f2937;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ================== 头部 ================== */
.header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 0;
    /* PC端默认不固定，随页面滚动 */
    position: relative;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    justify-content: space-between;
    /* PC端恢复两端对齐 */
    align-items: center;
    position: relative;
}

/* logo */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    position: static;
    /* PC端取消绝对定位 */
    transform: none;
}

.logo-icon-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.logo-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* PC端左对齐 */
}

.logo-text h1 {
    font-size: 24px;
    font-weight: 800;
    color: #111827;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.logo-text p {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    position: static;
    /* PC端取消绝对定位 */
    transform: none;
}

.data-source {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4b5563;
    font-size: 14px;
    background: #f3f4f6;
    padding: 6px 12px;
    border-radius: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.refresh-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.refresh-btn:hover {
    background: #2563eb;
}

.refresh-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.icon-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn svg {
    width: 24px;
    height: 24px;
}

.icon-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.icon-btn.active {
    color: #3b82f6;
    background: #eff6ff;
}

.icon-btn.active svg {
    fill: currentColor;
}

/* ================== 主内容 ================== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    padding-bottom: 80px;
}

.section-title {
    font-size: 32px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    text-align: center;
    /* 居中对齐 */
}

.section-description {
    color: #6b7280;
    font-size: 16px;
    margin-bottom: 32px;
    text-align: center;
    /* 居中对齐 */
}

/* ================== 筛选栏 (Sticky) ================== */
.filter-card {
    position: sticky;
    top: 0;
    z-index: 90;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e7eb;
    margin: 0 -24px 24px -24px;
    /* 抵消 main padding */
    padding: 16px 24px;
    /* 适配刘海屏：当吸顶时，确保背景色覆盖安全区域 */
    /* 注意：这里 top:0 会吸附到视口顶部。如果 header 滚走了，它就到顶了 */
}

.filter-tabs {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 500;
    color: #4b5563;
    white-space: nowrap;
}

/* Pill Style Tabs */
.tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    /* Pill shape */
    cursor: pointer;
    transition: all 0.2s;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
}

.tab:hover {
    background: #f9fafb;
    transform: translateY(-1px);
}

.tab.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.tab-emoji {
    font-size: 16px;
}

.tab-count {
    background: #f3f4f6;
    color: #6b7280;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.tab.active .tab-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* ================== 加载 & 错误 ================== */
.loading-indicator {
    text-align: center;
    padding: 40px 0;
    color: #6b7280;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ================== 时间线新闻列表 ================== */
.news-list {
    position: relative;
    padding-left: 20px;
    /* PC端留出时间线空间 */
}

/* PC端垂直线 */
.news-list::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #bfdbfe, #dbeafe);
    display: block;
}

.timeline-group {
    margin-bottom: 40px;
}

.date-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    position: relative;
}

.date-badge {
    background: white;
    border: 1px solid #e5e7eb;
    padding: 6px 16px;
    border-radius: 999px;
    font-weight: 600;
    color: #1f2937;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-line {
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.news-items {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.news-card {
    background: white;
    border: 1px solid #f3f4f6;
    border-radius: 16px;
    padding: 24px;
    position: relative;
    transition: all 0.3s;
    margin-left: 20px;
    /* 距离时间线 */
}

.news-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: #bfdbfe;
    transform: translateY(-2px);
}

/* 时间线圆点 */
.news-card::before {
    content: '';
    position: absolute;
    left: -29px;
    /* 对齐垂直线 */
    top: 30px;
    width: 12px;
    height: 12px;
    background: #3b82f6;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #bfdbfe;
    z-index: 5;
}

/* ================== 卡片模式 (无时间线) ================== */
.news-list.mode-cards {
    padding-left: 0;
}

.news-list.mode-cards::before {
    display: none;
}

.news-list.mode-cards .news-card {
    margin-left: 0;
    margin-bottom: 20px;
}

.news-list.mode-cards .news-card::before {
    display: none;
}

.news-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.news-time-tag {
    display: flex;
    align-items: center;
    gap: 12px;
}

.news-time {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.news-tag {
    background: linear-gradient(to right, #f97316, #ea580c);
    color: white;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.news-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 12px;
    line-height: 1.4;
}

.news-title a {
    color: #111827;
    text-decoration: none;
    transition: color 0.2s;
}

.news-title a:hover {
    color: #2563eb;
}

.news-content {
    color: #4b5563;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.news-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

.news-source {
    color: #9ca3af;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.view-original {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: linear-gradient(to right, #3b82f6, #2563eb);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.view-original:hover {
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.4);
    transform: translateX(2px);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 900;
    font-size: 20px;
    color: #3b82f6;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

/* PC端默认隐藏移动端标题 */
.mobile-title-container {
    display: none;
}

/* ================== 响应式 ================== */
@media(max-width:768px) {
    .header {
        height: auto;
        padding: 12px 16px;
        position: relative;
    }

    .header-content {
        flex-direction: column;
        gap: 16px;
        height: auto;
        position: static;
    }

    /* 移动端隐藏 PC Logo */
    .pc-logo {
        display: none;
    }

    /* 移动端标题容器 - 绝对居中 */
    .mobile-title-container {
        display: flex;
        justify-content: center;
        width: 100%;
        position: relative;
    }

    .mobile-title-wrapper {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        /* 文字居中 */
    }

    /* 移动端 Logo - 绝对定位在标题左侧 */
    .mobile-logo-icon {
        position: absolute;
        right: 100%;
        /* 挂在左侧 */
        top: 50%;
        transform: translateY(-50%);
        margin-right: 12px;
        /* 间距 */
        width: 40px;
        height: 40px;
        object-fit: contain;
    }

    .logo-text {
        align-items: center;
        /* 移动端文字居中 */
    }

    .header-title-center {
        margin-bottom: 12px;
    }

    .logo-text h1 {
        font-size: 20px;
        line-height: 1.2;
    }

    .logo-text p {
        font-size: 13px;
    }

    /* 移动端操作栏 */
    .header-actions {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 10px;
        justify-content: flex-start;
        /* 默认左对齐 */
    }

    /* 让铃铛按钮自动靠右 */
    #subscribeBtn {
        margin-left: auto;
    }

    .data-source {
        font-size: 12px;
        padding: 4px 10px;
        flex-shrink: 0;
    }

    /* 移动端筛选栏 - 完美吸顶方案 */
    .filter-card {
        position: sticky;
        top: 0;
        z-index: 90;

        /* 强制全屏宽度，无视父容器 padding */
        width: 100vw;
        margin-left: -16px;
        /* 抵消 main-content 的 padding-left */
        margin-right: -16px;
        /* 抵消 main-content 的 padding-right */
        margin-bottom: 16px;

        padding: 12px 16px;
        /* 适配刘海屏顶部安全区域 */
        padding-top: calc(12px + env(safe-area-inset-top));

        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);

        border-radius: 0;
        border-bottom: 1px solid #e5e7eb;
        border-top: none;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);

        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .filter-card::-webkit-scrollbar {
        display: none;
    }

    .filter-tabs {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        padding-right: 16px;
        width: max-content;
        /* 确保内容能撑开宽度 */
    }

    .tab {
        flex-shrink: 0;
        /* 核心：禁止标签被压缩 */
        white-space: nowrap;
    }

    .main-content {
        padding: 24px 16px 0;
        /* 增加顶部内边距，拉大与 Header 的距离 */
    }

    .section-title {
        font-size: 24px;
        margin-bottom: 8px;
    }

    .section-description {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .news-header {
        gap: 10px;
    }

    .news-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}