/**
 * 首页文章轮播系统样式
 * 混合式智能轮播 - 优雅的过渡动画和交互效果
 * Author: Madechango Team
 * Version: 1.0.0
 */

/* === 轮播容器基础样式 === */
.articles-carousel-container {
    position: relative;
    overflow: hidden;
}

.articles-grid {
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity;
}

.articles-grid.transitioning {
    pointer-events: none;
}

/* === 轮播控制界面 === */
.carousel-controls {
    position: absolute;
    top: -60px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 10;
}

/* 指示器样式 */
.carousel-indicators {
    display: flex;
    gap: 8px;
    align-items: center;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.indicator:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: scale(1.2);
}

.indicator.active {
    background: var(--bs-primary, #0d6efd);
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.4);
}

/* 控制按钮样式 */
.carousel-buttons {
    display: flex;
    gap: 5px;
}

.carousel-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--bs-primary, #0d6efd);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.carousel-btn:hover {
    background: var(--bs-primary, #0d6efd);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.carousel-btn:active {
    transform: scale(0.95);
}

/* 进度条样式 */
.carousel-progress {
    width: 60px;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--bs-primary, #0d6efd), var(--bs-info, #0dcaf0));
    border-radius: 2px;
    width: 0%;
    transition: width 5s linear;
}

/* === 科幻模式适配 === */
body.scifi-mode .carousel-controls {
    color: #00ff88;
}

body.scifi-mode .indicator {
    background: rgba(0, 255, 136, 0.3);
    box-shadow: 0 0 5px rgba(0, 255, 136, 0.2);
}

body.scifi-mode .indicator:hover {
    background: rgba(0, 255, 136, 0.5);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
}

body.scifi-mode .indicator.active {
    background: #00ff88;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.8);
}

body.scifi-mode .carousel-btn {
    background: rgba(26, 26, 46, 0.9);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}

body.scifi-mode .carousel-btn:hover {
    background: rgba(0, 255, 136, 0.2);
    color: #00ffaa;
    border-color: #00ff88;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

body.scifi-mode .carousel-progress {
    background: rgba(0, 255, 136, 0.1);
    box-shadow: inset 0 0 5px rgba(0, 255, 136, 0.2);
}

body.scifi-mode .progress-bar {
    background: linear-gradient(90deg, #00ff88, #00ffaa);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.6);
}

/* === 深色模式适配 === */
body.dark-mode .carousel-controls {
    color: #ffffff;
}

body.dark-mode .indicator {
    background: rgba(255, 255, 255, 0.3);
}

body.dark-mode .indicator:hover {
    background: rgba(255, 255, 255, 0.5);
}

body.dark-mode .indicator.active {
    background: #66b3ff;
    box-shadow: 0 0 10px rgba(102, 179, 255, 0.4);
}

body.dark-mode .carousel-btn {
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

body.dark-mode .carousel-btn:hover {
    background: #66b3ff;
    color: #000000;
    border-color: #66b3ff;
}

body.dark-mode .carousel-progress {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .progress-bar {
    background: linear-gradient(90deg, #66b3ff, #99ccff);
}

/* === 响应式设计 === */
@media (max-width: 768px) {
    .carousel-controls {
        top: -50px;
        right: 10px;
        gap: 10px;
    }
    
    .carousel-btn {
        width: 28px;
        height: 28px;
        font-size: 10px;
    }
    
    .carousel-progress {
        width: 40px;
        height: 2px;
    }
    
    .indicator {
        width: 6px;
        height: 6px;
    }
}

@media (max-width: 480px) {
    .carousel-controls {
        position: static;
        justify-content: center;
        margin-top: 20px;
        margin-bottom: 10px;
    }
    
    .carousel-indicators {
        order: 2;
    }
    
    .carousel-buttons {
        order: 1;
    }
    
    .carousel-progress {
        order: 3;
        margin-top: 10px;
    }
}

/* === 文章卡片悬停增强 === */
.articles-grid .guide-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.articles-grid .guide-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* 科幻模式下的卡片悬停效果 */
body.scifi-mode .articles-grid .guide-card:hover {
    border-color: #00ffaa;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.6);
    transform: translateY(-8px) scale(1.02);
}

/* === 加载状态样式 === */
.carousel-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--bs-text-muted, #6c757d);
    font-size: 14px;
}

.carousel-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--bs-primary, #0d6efd);
    border-top: 2px solid transparent;
    border-radius: 50%;
    margin-right: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === 平滑滚动优化 === */
.articles-carousel-container * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === 性能优化 === */
.articles-grid {
    contain: layout style paint;
    transform: translateZ(0); /* 启用硬件加速 */
}

.guide-card img {
    will-change: transform;
    backface-visibility: hidden;
}

/* === 无障碍支持 === */
.carousel-btn:focus {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 2px;
}

.indicator:focus {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 2px;
}

/* 减少动画对于偏好减少动画的用户 */
@media (prefers-reduced-motion: reduce) {
    .articles-grid,
    .carousel-btn,
    .indicator,
    .guide-card {
        transition: none !important;
        animation: none !important;
    }
    
    .progress-bar {
        transition: width 0.1s linear !important;
    }
}

/* === 高对比度模式支持 === */
@media (prefers-contrast: high) {
    .carousel-btn {
        border: 2px solid currentColor;
    }
    
    .indicator {
        border: 1px solid currentColor;
    }
    
    .progress-bar {
        background: currentColor;
    }
}

/* === 打印样式 === */
@media print {
    .carousel-controls {
        display: none;
    }
    
    .articles-grid .guide-card:hover {
        transform: none;
        box-shadow: none;
    }
}
