/* 轮播图样式 */
.carousel {
    position: relative;
    overflow: hidden;
    touch-action: pan-y pinch-zoom; /* 允许触摸滑动 */
}

.carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
    z-index: 1;
    will-change: opacity, transform; /* 优化动画性能 */
}

.carousel-item.active {
    opacity: 1;
    z-index: 2;
    transform: translateX(0);
}

.carousel-item.prev {
    opacity: 0;
    transform: translateX(-100%);
}

.carousel-item.next {
    opacity: 0;
    transform: translateX(100%);
}

/* 新的首页轮播图样式 */
#hero-carousel {
    position: relative;
    overflow: hidden;
}

#hero-slider {
    display: flex;
    transition: transform 0.5s ease-in-out;
    height: 100%;
}

#hero-slider .flex-shrink-0 {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
}

/* 轮播图背景图片优化 */
.carousel-item > div {
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* 触摸设备上禁用背景固定 */
@media (hover: none) and (pointer: coarse) {
    .carousel-item > div {
        background-attachment: scroll;
    }
}

/* 轮播图内容动画 */
.slide-title {
    animation: slideInUp 1s ease-out 0.3s both;
}

.slide-subtitle {
    animation: slideInUp 1s ease-out 0.6s both;
}

.slide-button {
    animation: slideInUp 1s ease-out 0.9s both;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 导航点样式 */
.carousel-dot {
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.carousel-dot:hover,
.carousel-dot.active {
    opacity: 1 !important;
    transform: scale(1.2);
}

.carousel-dot.active {
    background: linear-gradient(45deg, #3b82f6, #1d4ed8);
}

/* 箭头导航样式 */
.carousel-prev,
.carousel-next {
    border: none;
    outline: none;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    opacity: 0;
}

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

.carousel-prev:hover,
.carousel-next:hover {
    opacity: 1 !important;
    background-color: rgba(0, 0, 0, 0.6);
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev:active,
.carousel-next:active {
    transform: translateY(-50%) scale(0.95);
}

/* 导航栏下拉菜单 */
.group:hover .group-hover\:opacity-100 {
    opacity: 1;
}

.group:hover .group-hover\:visible {
    visibility: visible;
}

/* 下拉菜单默认隐藏 */
#userDropdown {
    display: none;
    z-index: 1000;
}

/* 确保下拉菜单过渡效果 */
#userDropdown.opacity-100 {
    opacity: 1;
}

#userDropdown.opacity-0 {
    opacity: 0;
}

#userDropdown.visible {
    visibility: visible;
}

#userDropdown.invisible {
    visibility: hidden;
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 卡片悬停效果 */
.hover\:shadow-xl:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 按钮动画 */
.transition-colors {
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

/* 响应式视频 */
.video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
}

.video-responsive iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* 视频容器样式 */
.video-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 0.5rem;
    overflow: hidden;
}

.video-player {
    display: block;
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: contain;
    background: #000;
}

/* 移动端视频优化 */
@media (max-width: 768px) {
    .video-player {
        max-height: 220px;
    }
    
    .video-wrapper {
        border-radius: 0.5rem;
    }
}

@media (max-width: 640px) {
    .video-player {
        max-height: 200px;
    }
    
    /* 视频卡片优化 */
    .video-wrapper {
        margin-bottom: 0;
    }
}

@media (max-width: 480px) {
    .video-player {
        max-height: 180px;
    }
}

/* 活动图片高度优化 */
@media (max-width: 768px) {
    /* 活动卡片图片高度 */
    .h-64 {
        height: 12rem !important; /* 从16rem(256px)减到12rem(192px) */
    }
}

@media (max-width: 640px) {
    /* 小屏幕活动卡片图片高度 */
    .h-64 {
        height: 10rem !important; /* 从16rem减到10rem(160px) */
    }
    
    /* 视频标题间距 */
    .mt-8 {
        margin-top: 1.5rem !important;
    }
}

@media (max-width: 480px) {
    /* 超小屏幕活动卡片图片高度 */
    .h-64 {
        height: 9rem !important; /* 144px */
    }
    
    /* 统计数据超小屏幕优化 - 保持2列布局 */
    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    .stats-section .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .stats-item {
        padding: 1.25rem 0.25rem !important;
    }
    
    .stats-item div:first-child {
        font-size: 1.75rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .stats-item div:last-child {
        font-size: 0.7rem !important;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 新轮播图样式 */
.carousel-container {
    position: relative;
    overflow: hidden;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.carousel-container .carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    z-index: 1;
}

.carousel-container .carousel-item.active {
    opacity: 1;
    z-index: 2;
}

.carousel-container .carousel-prev,
.carousel-container .carousel-next {
    opacity: 0;
    transition: all 0.3s ease;
}

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

.carousel-container .carousel-prev:hover,
.carousel-container .carousel-next:hover {
    background-color: rgba(0, 0, 0, 0.6) !important;
    transform: translateY(-50%) scale(1.1);
}

.carousel-container .carousel-dot {
    transition: all 0.3s ease;
}

.carousel-container .carousel-dot:hover,
.carousel-container .carousel-dot.active {
    opacity: 1 !important;
    transform: scale(1.2);
}

.carousel-container .carousel-dot.active {
    background: linear-gradient(45deg, #3b82f6, #1d4ed8);
}

/* 新轮播图响应式设计 */
@media (max-width: 768px) {
    .carousel-container {
        height: 400px !important;
    }
    
    .carousel-container .slide-title {
        font-size: 2rem !important;
    }
    
    .carousel-container .slide-subtitle {
        font-size: 1rem !important;
    }
    
    .carousel-container img {
        width: 3rem !important;
        height: 3rem !important;
    }
}

@media (max-width: 640px) {
    .carousel-container {
        height: 350px !important;
    }
    
    .carousel-container .slide-title {
        font-size: 1.5rem !important;
    }
    
    .carousel-container .slide-subtitle {
        font-size: 0.875rem !important;
    }
    
    .carousel-container img {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }
}

/* 移动端导航栏优化 */
@media (max-width: 768px) {
    .max-w-7xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* 移动端菜单动画 */
    #mobile-menu {
        transition: all 0.3s ease;
    }
    
    /* 移动端标题自适应 */
    .gradient-bg h1 {
        font-size: 1.5rem;
    }
    
    .gradient-bg p {
        font-size: 0.875rem;
    }
    
    /* 移动端卡片布局 */
    .chapter-card {
        margin-bottom: 1rem;
    }
    
    /* 移动端面包屑 */
    .breadcrumb-mobile {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    /* 移动端轮播图优化 */
    .slide-title {
        font-size: 1.5rem !important;
        line-height: 1.3;
        padding: 0 1rem;
    }
    
    .slide-subtitle {
        font-size: 0.875rem !important;
        line-height: 1.4;
        padding: 0 1rem;
    }
    
    .slide-button {
        font-size: 0.875rem !important;
        padding: 0.5rem 1.5rem !important;
    }
    
    /* 轮播图图标调整 */
    section .w-32,
    section .md\:w-40 {
        width: 4rem !important;
        height: 4rem !important;
    }
    
    /* 轮播图高度调整 */
    section[style*="height: 75vh"],
    .hero-carousel-section {
        height: 50vh !important;
        min-height: 400px !important;
        max-height: 500px !important;
    }
}

@media (max-width: 640px) {
    /* 超小屏幕优化 */
    .gradient-bg {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    .gradient-bg h1 {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    .gradient-bg .flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    /* 章节卡片在手机上单列显示 */
    .grid {
        grid-template-columns: 1fr !important;
    }
    
    /* 小屏幕轮播图进一步优化 */
    .slide-title {
        font-size: 1.25rem !important;
        line-height: 1.2;
        margin-bottom: 0.75rem !important;
    }
    
    .slide-subtitle {
        font-size: 0.75rem !important;
        line-height: 1.3;
        margin-bottom: 1rem !important;
    }
    
    .slide-button {
        font-size: 0.75rem !important;
        padding: 0.5rem 1.25rem !important;
    }
    
    /* 轮播图图标进一步缩小 */
    section .w-32,
    section .md\:w-40 {
        width: 3rem !important;
        height: 3rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* 小屏幕轮播图高度 */
    section[style*="height: 75vh"],
    .hero-carousel-section {
        height: 40vh !important;
        min-height: 320px !important;
        max-height: 400px !important;
    }
    
    /* 移动端按钮和链接间距优化 */
    .space-y-4 > * + * {
        margin-top: 0.75rem !important;
    }
    
    /* 移动端容器内边距 */
    .px-4 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增加触摸目标大小 */
    button, a {
        min-height: 44px;
    }
    
    /* 禁用悬停效果 */
    .hover\:shadow-xl:hover {
        box-shadow: inherit;
    }
    
    /* 优化轮播图箭头按钮 */
    .carousel-prev,
    .carousel-next {
        opacity: 0.5 !important;
    }
}

/* 超小屏幕特殊优化 */
@media (max-width: 375px) {
    .slide-title {
        font-size: 1.1rem !important;
        line-height: 1.2;
    }
    
    .slide-subtitle {
        font-size: 0.7rem !important;
        line-height: 1.3;
    }
    
    .slide-button {
        font-size: 0.7rem !important;
        padding: 0.4rem 1rem !important;
    }
    
    .hero-carousel-section {
        height: 35vh !important;
        min-height: 280px !important;
        max-height: 350px !important;
    }
}

/* 移动端轮播图内容垂直居中优化 */
@media (max-width: 768px) {
    .hero-carousel-section .flex.items-center {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    /* 统计数据移动端优化 */
    .stats-section {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }
    
    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
    }
    
    .stats-section .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .stats-item {
        padding: 1rem 0.5rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .stats-number {
        white-space: nowrap;
    }
    
    .stats-label {
        white-space: nowrap;
    }
    
    /* 页脚移动端优化 */
    footer {
        font-size: 14px;
    }
    
    footer .grid {
        gap: 1.5rem;
    }
    
    /* 优化标题和段落文字大小 */
    h2.text-4xl {
        font-size: 1.75rem !important;
    }
    
    h3.text-3xl {
        font-size: 1.5rem !important;
    }
    
    p.text-xl {
        font-size: 1rem !important;
    }
    
    p.text-lg {
        font-size: 0.95rem !important;
    }
}

@media (max-width: 640px) {
    /* 统计数据小屏幕优化 */
    .stats-section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    .stats-section .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .stats-item {
        padding: 1.5rem 0.5rem !important;
    }
    
    .stats-item div:first-child {
        font-size: 2rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .stats-item div:last-child {
        font-size: 0.75rem !important;
        line-height: 1.2;
    }
    
    /* 页脚小屏幕优化 */
    footer {
        font-size: 13px;
    }
    
    footer .py-8 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    /* 进一步优化标题 */
    h2.text-4xl {
        font-size: 1.5rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    h3.text-3xl {
        font-size: 1.25rem !important;
    }
    
    h4.text-xl {
        font-size: 1rem !important;
    }
    
    p.text-xl {
        font-size: 0.875rem !important;
    }
    
    p.text-lg {
        font-size: 0.875rem !important;
    }
    
    /* 优化间距 */
    .py-20 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }
    
    .py-12 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .mb-16 {
        margin-bottom: 2rem !important;
    }
    
    /* 防止长文本溢出 */
    footer li {
        word-break: break-word;
        overflow-wrap: break-word;
    }
}

/* 全局移动端文字优化 */
@media (max-width: 768px) {
    body {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
    
    /* 防止水平滚动 */
    body, html {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    /* 确保所有容器不超出屏幕 */
    * {
        max-width: 100%;
    }
    
    /* 图片响应式 */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* 视频响应式 */
    video {
        max-width: 100%;
        height: auto;
    }
} 