/**
 * News Carousel Module CSS
 * Author: AI Assistant
 * Description: Homepage news carousel with swipe navigation and auto-play
 */

/* ===== 新闻板块布局对齐 ===== */
.news {
    max-width: 1680px;
    margin: 100px auto;
    padding: 0 0px;
}

/* ===== 新闻轮播容器 ===== */
.news-carousel-container {
    position: relative;
    max-width: 1680px;
    margin: 0 auto;
    padding: 0 0px;
    overflow: visible;
}

.news-carousel-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    margin: 0;
}

.news-carousel-track {
    display: flex;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    width: fit-content;
}

/* ===== 新闻卡片样式 ===== */
.news-carousel-slide {
    flex: 0 0 calc(25% - 20px);
    margin: 0 10px;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    height: 420px;
    display: flex;
    flex-direction: column;
}

.news-carousel-slide:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(235, 102, 48, 0.15);
}

/* ===== 链接样式重置 ===== */
.news-slide-link {
    display: block;
    text-decoration: none !important;
    color: inherit !important;
    height: 100%;
}

.news-slide-link:hover,
.news-slide-link:visited,
.news-slide-link:active,
.news-slide-link:focus {
    text-decoration: none !important;
    color: inherit !important;
}

.news-slide-link:focus {
    outline: 2px solid #EB6630;
    outline-offset: 2px;
}

/* 禁用所有子元素的默认链接样式 */
.news-slide-link *,
.news-slide-link *:hover,
.news-slide-link *:visited,
.news-slide-link *:active {
    text-decoration: none !important;
    color: inherit !important;
}

/* ===== 图片区域 ===== */
.news-slide-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

.news-slide-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.news-carousel-slide:hover .news-slide-image img {
    transform: scale(1.05);
}

/* 无图片占位符 */
.news-slide-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #999;
    flex-direction: column;
}

.news-slide-placeholder i {
    font-size: 48px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.news-slide-placeholder span {
    font-size: 14px;
    opacity: 0.8;
}

/* 图片遮罩层 */
.news-slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(235, 102, 48, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: all 0.3s ease;
    font-weight: 500;
}

.news-slide-overlay i {
    font-size: 24px;
    margin-bottom: 8px;
    transform: translateY(10px);
    transition: transform 0.3s ease 0.1s;
}

.news-slide-overlay span {
    font-size: 14px;
    transform: translateY(10px);
    transition: transform 0.3s ease 0.15s;
}

.news-carousel-slide:hover .news-slide-overlay {
    opacity: 1;
}

.news-carousel-slide:hover .news-slide-overlay i,
.news-carousel-slide:hover .news-slide-overlay span {
    transform: translateY(0);
}

/* ===== 内容区域 ===== */
.news-slide-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 元信息 */
.news-slide-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 12px;
}

.news-slide-date {
    color: #EB6630;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.news-slide-date i {
    font-size: 11px;
    opacity: 0.8;
}

.news-slide-category {
    background: linear-gradient(135deg, #EB6630, #FF7F50);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* 标题 */
.news-slide-title {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 14px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}

.news-carousel-slide:hover .news-slide-title {
    color: #EB6630;
}

/* 摘要 */
.news-slide-excerpt {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* 阅读更多按钮 */
.news-slide-read-more {
    color: #EB6630;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    margin-top: auto;
}

.news-slide-read-more i {
    transition: transform 0.3s ease;
}

.news-carousel-slide:hover .news-slide-read-more i {
    transform: translateX(5px);
}

/* ===== 轮播控制按钮 - 隐藏（使用自动轮播） ===== */
.carousel-nav-btn {
    display: none !important;
}

/* ===== 指示器 ===== */
.carousel-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    gap: 12px;
}

.carousel-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d1d5db;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    position: relative;
}

.carousel-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: transparent;
    transition: all 0.3s ease;
}

.carousel-indicator.active {
    background: #EB6630;
    transform: scale(1.2);
}

.carousel-indicator.active::before {
    background: white;
}

.carousel-indicator:hover {
    background: #EB6630;
    transform: scale(1.1);
}

/* ===== 查看更多按钮 ===== */
.news-view-more-section {
    text-align: center;
    margin-top: 50px;
}

.news-view-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #EB6630, #ff8a50);
    color: white;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(235, 102, 48, 0.2);
    position: relative;
    overflow: hidden;
}

.news-view-more-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.news-view-more-btn:hover::before {
    left: 100%;
}

.news-view-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(235, 102, 48, 0.3);
    color: white;
    text-decoration: none;
}

.news-view-more-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.news-view-more-btn:hover i {
    transform: translateX(5px);
}

/* 移除复杂的文字结构样式 */
.news-view-more-text {
    display: none;
}

.news-view-more-main {
    display: none;
}

.news-view-more-sub {
    display: none;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1024px) {
    .news-carousel-slide {
        flex: 0 0 calc(33.333% - 20px);
    }
    
    .news-carousel-container {
        padding: 0 20px;
    }
}

@media (max-width: 768px) {
    .news-carousel-container {
        padding: 0 20px;
    }
    
    .news-carousel-slide {
        flex: 0 0 calc(50% - 20px);
        height: 380px;
    }
    
    .news-slide-image {
        height: 180px;
    }
    
    .news-slide-content {
        padding: 20px;
    }
    
    .news-slide-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .news-slide-excerpt {
        font-size: 13px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        margin-bottom: 16px;
    }
    
    .news-view-more-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .news-carousel-container {
        padding: 0 20px;
    }
    
    .news-carousel-slide {
        flex: 0 0 calc(100% - 20px);
        height: 350px;
        margin: 0 10px;
    }
    
    .news-slide-image {
        height: 160px;
    }
    
    .news-slide-content {
        padding: 16px;
    }
    
    .news-slide-title {
        font-size: 15px;
    }
    
    .news-slide-excerpt {
        font-size: 12px;
    }
    
    .carousel-indicators {
        margin-top: 20px;
        gap: 8px;
    }
    
    .carousel-indicator {
        width: 10px;
        height: 10px;
    }
}



/* ===== 性能优化 ===== */
.news-carousel-track {
    backface-visibility: hidden;
    perspective: 1000px;
}

.news-carousel-slide {
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* ===== 额外的样式修复 ===== */
/* 确保容器在所有浏览器中正确显示 */
.news-carousel-container {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* 防止文字选择和拖拽 */
.news-carousel-slide {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 移除所有可能的链接默认样式 */
.news-carousel-container a,
.news-carousel-container a:link,
.news-carousel-container a:visited,
.news-carousel-container a:hover,
.news-carousel-container a:active {
    color: inherit !important;
    text-decoration: none !important;
    border: none !important;
    outline: none !important;
}

.news-carousel-container a:focus {
    outline: 2px solid #EB6630 !important;
    outline-offset: 2px !important;
}

/* 预加载动画 */
.news-carousel-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 420px;
    color: #999;
}

.news-carousel-loading i {
    font-size: 32px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 无障碍访问优化 */
.carousel-nav-btn:focus,
.carousel-indicator:focus,
.news-view-more-btn:focus {
    outline: 2px solid #EB6630;
    outline-offset: 2px;
}

/* 减少动画的用户偏好支持 */
@media (prefers-reduced-motion: reduce) {
    .news-carousel-track,
    .news-carousel-slide,
    .news-slide-image img,
    .carousel-nav-btn,
    .carousel-indicator {
        transition: none;
    }
    
    .news-carousel-loading i {
        animation: none;
    }
}