/* 修复Development History板块在移动端显示不完整的问题 */

/* 统一卡片高度并添加滚动条 */
.event-card {
    height: 420px !important; /* 设置统一的固定高度 */
    min-height: 420px !important;
    overflow: hidden !important; /* 隐藏卡片本身的溢出内容 */
    display: flex;
    flex-direction: column;
}

/* 确保timeline容器有足够高度容纳所有内容 */
.timeline-content-wrapper {
    min-height: auto !important;
    height: auto !important;
}

.timeline-events {
    min-height: auto !important;
    height: auto !important;
}

/* 优化卡片内容显示 - 统一添加滚动条 */
.event-description {
    word-wrap: break-word; /* 确保长单词不会导致溢出 */
    hyphens: auto; /* 允许在单词中间换行 */
    max-height: 180px; /* 设置描述文本的最大高度 */
    overflow-y: auto; /* 为超长描述添加垂直滚动条 */
    scrollbar-width: thin; /* Firefox: 细滚动条 */
    flex-grow: 1; /* 让描述部分占据剩余空间 */
}

/* 美化垂直滚动条 */
.event-description::-webkit-scrollbar {
    width: 4px;
}

.event-description::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

.event-description::-webkit-scrollbar-thumb {
    background: rgba(0, 71, 107, 0.3);
    border-radius: 2px;
}

.event-description::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 71, 107, 0.5);
}

/* PC端卡片间距调整和导航按钮位置调整 */
@media (min-width: 769px) {
    .timeline-events {
        gap: 10px !important; /* 将PC端卡片间距从15px进一步减小到10px */
    }
    
    /* 将PC端导航按钮调整到卡片中线位置 */
    .timeline-nav {
        top: calc(50% + 3px) !important; /* 再向上移动12px左右 */
    }
}

/* 移动端适配 - 768px及以下 */
@media (max-width: 768px) {
    .event-card {
        width: 100%; /* 让卡片在移动设备上宽度自适应父容器 */
        max-width: 320px; /* 设置最大宽度，防止过宽 */
        height: 380px !important; /* 移动端统一固定高度 */
        min-height: 380px !important;
        padding: 1.5rem; /* 调整内边距以适应小屏幕 */
        margin-bottom: 1.5rem; /* 增加底部间距，确保卡片之间有足够空间 */
        display: flex;
        flex-direction: column;
    }
    
    .timeline-event {
        width: 100%; /* 让事件容器宽度自适应 */
        max-width: 320px; /* 设置最大宽度 */
        height: 380px !important;
    }
    
    .event-description {
        font-size: 0.875rem; /* 调整字体大小以提高可读性 */
        line-height: 1.6; /* 增加行高以提高可读性 */
        max-height: 120px; /* 调整最大高度 */
        flex-grow: 1;
    }
    
    /* 调整标题字体大小，确保不会因为文字过长导致溢出 */
    .event-title {
        font-size: 1.125rem;
        line-height: 1.4;
    }
    
    /* 确保年份和图标部分不会溢出 */
    .event-header {
        flex-wrap: nowrap; /* 禁止换行，保持原有布局 */
        gap: 0.5rem;
        flex-direction: row; /* 确保横向排列 */
        align-items: center; /* 垂直居中对齐 */
        justify-content: space-between; /* 保持两端对齐 */
    }
    
    .event-year {
        font-size: 0.875rem;
        padding: 0.375rem 1rem;
    }
}

/* 超小屏幕适配 - 480px及以下 */
@media (max-width: 480px) {
    .event-card {
        width: 100%;
        max-width: 280px;
        height: 360px !important; /* 超小屏幕统一固定高度 */
        min-height: 360px !important;
        padding: 1.25rem;
        display: flex;
        flex-direction: column;
    }
    
    .timeline-event {
        width: 100%;
        max-width: 280px;
        height: 360px !important;
    }
    
    .event-description {
        font-size: 0.8125rem;
        max-height: 100px;
        flex-grow: 1;
    }
    
    .event-title {
        font-size: 1rem;
    }
    
    /* 超小屏幕下保持地区标签位置不变 */
    .event-header {
        flex-wrap: nowrap; /* 禁止换行 */
        flex-direction: row; /* 保持横向排列 */
        align-items: center; /* 垂直居中对齐 */
        justify-content: space-between; /* 保持两端对齐 */
        gap: 0.5rem;
    }
    
    /* 进一步调整内边距和间距 */
    .timeline-events {
        gap: 1rem !important;
    }
    
    /* 确保导航按钮不会遮挡内容 */
    .timeline-nav {
        top: calc(50% - 25px);
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
    }
}

/* 修复JavaScript设置的固定宽度问题 */
.timeline-event {
    width: auto !important; /* 覆盖JavaScript设置的固定宽度 */
    max-width: 320px; /* 设置最大宽度 */
}