/* 全新轮播组件样式 - 现代简约设计 */

/* 主轮播容器 */
.carousel {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 2rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
}

/* 轮播内部容器 */
.carousel-inner {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: 12px;
}

/* 轮播项 - 防止翻页闪白 */
.carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block !important;
    opacity: 0;
    transition: opacity 0.8s ease-in-out !important;
    transform: none !important;
}

.carousel-item.active {
    position: relative;
    opacity: 1;
    z-index: 1;
}

/* 确保过渡时前后图片正确叠加 */
.carousel-item-next,
.carousel-item-prev {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    z-index: 2;
}

/* 移除Bootstrap默认的transform过渡 */
.carousel-inner {
    transform: none !important;
}

.carousel-fade .carousel-item {
    opacity: 0;
    transition-property: opacity;
    transform: none;
}

.carousel-fade .carousel-item.active,
.carousel-fade .carousel-item-next.carousel-item-left,
.carousel-fade .carousel-item-prev.carousel-item-right {
    opacity: 1;
}

.carousel-fade .active.carousel-item-left,
.carousel-fade .active.carousel-item-right {
    opacity: 0;
}

.carousel-fade .carousel-item-next,
.carousel-fade .carousel-item-prev,
.carousel-fade .carousel-item.active,
.carousel-fade .active.carousel-item-left,
.carousel-fade .active.carousel-item-prev {
    transform: none;
}

/* 确保在小屏幕上也有正确的高度 */
@media (max-width: 992px) {
    .carousel-inner {
        height: 350px;
    }
}

@media (max-width: 768px) {
    .carousel-inner {
        height: 300px;
    }
}

@media (max-width: 576px) {
    .carousel-inner {
        height: 250px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 轮播图片容器 */
.carousel-image-container {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
}

/* 轮播图片 */
.carousel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.carousel-item:hover .carousel-image {
    transform: scale(1.05);
}

/* 导航按钮 */
.carousel-control-prev,
.carousel-control-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 10;
    font-size: 1.2rem;
    opacity: 0;
}

.carousel:hover .carousel-control-prev,
.carousel:hover .carousel-control-next {
    opacity: 1;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.carousel-control-prev {
    left: 20px;
}

.carousel-control-next {
    right: 20px;
}

/* 指示器 - 使用更具体的选择器确保样式优先 */
.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
    z-index: 10;
}

.carousel-indicators button, 
.carousel-indicators [data-bs-target] {
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    background-color: rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
    position: static !important;
}

.carousel-indicators button:hover, 
.carousel-indicators [data-bs-target]:hover {
    background-color: rgba(255, 255, 255, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    transform: scale(1.3) !important;
    opacity: 1;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.carousel-indicators button.active, 
.carousel-indicators [data-bs-target].active {
    background-color: white !important;
    border-color: white !important;
    transform: scale(1.3) !important;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    opacity: 1;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* 标题区域 */
.carousel-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 30px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));
    color: white;
    text-align: center;
    transition: background 0.3s ease;
}

.carousel-caption h5 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 12px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease;
    letter-spacing: -0.5px;
}

.carousel-caption p {
    font-size: 1.1rem;
    max-width: 900px;
    margin: 0 auto;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    line-height: 1.6;
    opacity: 0.95;
}

/* 代码内容轮播样式 */
.carousel-code-content {
    width: 100%;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    color: #333;
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.carousel-code-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

/* 默认轮播内容样式 */
.carousel-default-content {
    width: 100%;
    height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    padding: 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.carousel-default-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.carousel-default-content h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 20px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.carousel-default-content p {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto;
    color: #555;
    line-height: 1.7;
}

/* 响应式调整 */
@media (max-width: 992px) {
    .carousel-image-container,
    .carousel-code-content,
    .carousel-default-content {
        height: 350px;
    }
    
    .carousel-caption h5 {
        font-size: 1.8rem;
    }
    
    .carousel-caption p {
        font-size: 1rem;
    }
    
    .carousel-default-content h1 {
        font-size: 2.2rem;
    }
}

@media (max-width: 768px) {
    .carousel {
        border-radius: 8px;
    }
    
    .carousel-image-container,
    .carousel-code-content,
    .carousel-default-content {
        height: 300px;
        padding: 25px;
    }
    
    .carousel-control-prev,
    .carousel-control-next {
        width: 40px;
        height: 40px;
        left: 15px;
        right: 15px;
        opacity: 1;
        background-color: rgba(255, 255, 255, 0.2);
        border-color: rgba(255, 255, 255, 0.4);
    }
    
    .carousel-caption {
        padding: 30px 20px;
    }
    
    .carousel-caption h5 {
        font-size: 1.5rem;
    }
    
    .carousel-caption p {
        font-size: 0.9rem;
    }
    
    .carousel-indicators {
        bottom: 15px;
    }
    
    .carousel-indicators button,
    .carousel-indicators [data-bs-target] {
        width: 12px !important;
        height: 12px !important;
    }
    
    .carousel-indicators button.active,
    .carousel-indicators [data-bs-target].active {
        transform: scale(1.3) !important;
    }
}

@media (max-width: 576px) {
    .carousel {
        border-radius: 6px;
    }
    
    .carousel-image-container,
    .carousel-code-content,
    .carousel-default-content {
        height: 250px;
        padding: 20px;
    }
    
    .carousel-control-prev,
    .carousel-control-next {
        width: 35px;
        height: 35px;
        left: 10px;
        right: 10px;
        background-color: rgba(255, 255, 255, 0.25);
        border-color: rgba(255, 255, 255, 0.5);
    }
    
    .carousel-caption {
        padding: 20px 15px;
    }
    
    .carousel-caption h5 {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }
    
    .carousel-caption p {
        font-size: 0.8rem;
    }
    
    .carousel-indicators {
        bottom: 10px;
        gap: 6px;
    }
    
    .carousel-indicators button,
    .carousel-indicators [data-bs-target] {
        width: 10px !important;
        height: 10px !important;
    }
    
    .carousel-indicators button.active,
    .carousel-indicators [data-bs-target].active {
        transform: scale(1.3) !important;
    }
    
    .carousel-default-content h1 {
        font-size: 1.8rem;
    }
    
    .carousel-default-content p {
        font-size: 1rem;
    }
}