/* ================================
   Homepage.css - 首页特定样式
   ================================ */

/* 现代化轮播图区域 - 白色画布包裹轮播图（卡片式设计）*/
.carousel-container {
    max-width: var(--content-width);
    margin: var(--space-xl) auto 0 auto; /* 下边距改为0，与内容区域无缝连接 */
    padding: var(--space-2xl) 25px 15px 25px; /* 添加内边距，轮播图被白色背景包裹 */
    background: rgba(255, 255, 255, 0.95); /* 白色半透明背景 */
    backdrop-filter: blur(10px);
    overflow: visible; /* 改为 visible，让轮播图阴影显示 */
    position: relative;
    z-index: 1;
    border-radius: var(--radius-lg) 12px 0 0; /* 只有顶部圆角 */
    /* 优化：统一为柔和阴影 */
    box-shadow: var(--shadow-md);
    /* 固定高度防止内容跳动（增加 padding 后需要调整）*/
    min-height: 670px;
}

.carousel-main {
    width: 100%;
    height: 520px;
    overflow: hidden;
    position: relative;
    border-radius: var(--radius-md);
    /* 优化：删除轮播图自身阴影，避免双重阴影 */
    box-shadow: none;
    /* 添加背景占位,防止图片加载前的空白 */
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15) 0%, rgba(232, 66, 90, 0.15) 100%);
}

/* 轮播链接元素铺满容器 */
.carousel-main > a {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    line-height: 0;
}

/* 骨架屏占位元素 - 使用纯CSS渐变,不加载图片，铺满容器 */
.banner-skeleton {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 107, 53, 0.1) 0%,
        rgba(232, 66, 90, 0.1) 25%,
        rgba(255, 107, 53, 0.08) 50%,
        rgba(232, 66, 90, 0.1) 75%,
        rgba(255, 107, 53, 0.1) 100%
    );
    background-size: 200% 200%;
    animation: skeleton-pulse 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

/* 骨架屏脉冲动画 */
@keyframes skeleton-pulse {
    0% {
        background-position: 0% 50%;
        opacity: 0.6;
    }
    50% {
        background-position: 100% 50%;
        opacity: 0.8;
    }
    100% {
        background-position: 0% 50%;
        opacity: 0.6;
    }
}

/* 骨架屏添加微光效果 */
.banner-skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    animation: skeleton-shimmer 2.5s infinite;
}

@keyframes skeleton-shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #f0f0f0;
    margin: 0;
    display: block;
    border-radius: var(--radius-md); /* 🔥 图片继承父容器圆角 */
    /* 优化过渡,防止闪烁 */
    transition: opacity var(--transition-base);
    /* 确保固定高度 */
    min-height: 520px;
}

.banner-img:hover {
    transform: scale(1.02);
}

/* 横幅加载状态 */
.carousel-main {
    position: relative;
}

/* 🔥 加载中容器 */
.banner-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

/* 加载中时显示 */
.carousel-main.loading .banner-loading {
    opacity: 1;
}

/* 加载中文字 */
.banner-loading p {
    color: var(--color-primary);
    font-size: 18px;
    font-weight: 500;
    margin: 15px 0 0 0;
    letter-spacing: 2px;
}

/* 🔥 旋转加载动画 */
.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto;
    border: 4px solid rgba(255, 107, 53, 0.2);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 加载完成后隐藏加载提示 */
.carousel-main:not(.loading) .banner-loading {
    display: none;
}

.carousel-main.banner-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-fallback-message {
    color: var(--color-primary);
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 1px;
    text-align: center;
}

/* 现代化轮播导航 */
.carousel-nav {
    display: flex;
    overflow-x: hidden;
    background: rgba(34, 34, 34, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: var(--space-sm) 0;
    border-radius: 0 0 8px 8px; /* 🔥 底部圆角，与轮播图匹配 */
    /* 固定导航栏高度 */
    min-height: 100px;
}

.carousel-item {
    position: relative;
    padding: var(--space-md);
    text-align: center;
    cursor: pointer;
    background: rgba(51, 51, 51, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    flex-shrink: 0;
    width: calc((100% / 6) - 8px);
    margin: 0 4px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.carousel-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.3), rgba(232, 66, 90, 0.3));
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.carousel-item.active::before,
.carousel-item:hover::before {
    opacity: 1;
}

.carousel-item.active,
.carousel-item:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
    border-color: rgba(255, 107, 53, 0.5);
}

.carousel-item img {
    width: 100%;
    height: 70px;
    object-fit: cover;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    position: relative;
    z-index: 1;
    filter: brightness(1.1) saturate(1.1); /* 保持常亮状态 */
}

.carousel-item:hover img {
    filter: brightness(1.2) saturate(1.3); /* 悬停时更亮 */
}

.carousel-item p {
    color: white;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 6px;
    height: calc(12px * 1.4 * 2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
}

/* 游戏评测区域 */
.game-reviews {
    margin: var(--space-3xl) 5%;
}

/* 内容模块 */
.content-module {
    margin: 0 0 30px 0;
    position: relative;
}

/* 首页特定的游戏卡片布局 */
#home-pinweiyouxi .game-card,
#home-lottery-main .lottery-card {
    width: calc(33.333% - 6.67px); /* 3张卡片一行 */
}

/* 现代化侧边栏模块 */
.sidebar-module {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: var(--space-2xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl),
        0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.sidebar-module::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left var(--transition-slow);
}

.sidebar-module:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl),
        0 4px 12px rgba(0, 0, 0, 0.08);
}

.sidebar-module:hover::before {
    left: 100%;
}

.sidebar-module .section-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-module .section-title {
    font-size: 18px;
}

.sidebar-module .section-title:after {
    width: 30px;
}

/* 现代化侧边栏列表项 */
.sidebar-list-item {
    display: flex;
    align-items: center;
    padding: 15px 8px;
    border-bottom: 1px solid rgba(240, 240, 240, 0.5);
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.sidebar-list-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(232, 66, 90, 0.1));
    transition: left var(--transition-slow);
}

.sidebar-list-item:last-child {
    border-bottom: none;
}

.sidebar-list-item:hover {
    background: rgba(255, 107, 53, 0.05);
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 107, 53, 0.2);
}

.sidebar-list-item:hover::before {
    left: 100%;
}

.sidebar-list-item:hover .sidebar-item-title {
    color: var(--color-primary);
    font-weight: 600;
}

.sidebar-item-info {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.sidebar-item-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-primary);
    line-height: 1.3;
    margin-bottom: 5px;
}

.sidebar-item-meta-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.sidebar-item-meta {
    font-size: 12px;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
}

.sidebar-item-meta i {
    margin-right: 4px;
}

/* 版块标题 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 22px;
    color: var(--color-text-primary);
    position: relative;
    padding-bottom: 10px;
}

.section-title:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background-color: var(--color-primary);
}

.more-link {
    color: var(--color-primary);
    font-size: 14px;
}

/* 分页控制 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    width: 100%;
    position: static;
}

.page-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background-color: rgba(238, 238, 238, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: var(--shadow-sm);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
}

.page-btn:hover {
    background-color: var(--color-primary);
    color: white;
}

.page-btn.prev {
    left: -15px;
}

.page-btn.next {
    right: -15px;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f0f0f0;
    color: #aaa;
}

/* 隐藏新闻模块的水平分页 */
#home-zixun > .page-btn {
    display: none !important;
}

/* 首页背景样式覆盖 */
body.homepage {
    background-image: image-set(url('/images/background-1920.avif') type('image/avif'), url('/images/background-1920.webp') type('image/webp'), url('/images/background.jpg') type('image/jpeg'));
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
}

/* 首页特定的内容区域样式 - 白色画布与轮播图无缝连接 */
.homepage .main-content-area {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 0 0 12px 12px; /* 只有底部圆角，与轮播图连接 */
    padding: var(--space-2xl);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-xl); /* 完整的阴影，覆盖整个白色画布 */
    max-width: var(--content-width);
    margin: 0 auto 30px auto; /* 上边距改为0，与轮播图无缝连接 */
}

/* 首页轮播图特效 */
.carousel-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(51, 102, 204, 0.1), rgba(255, 102, 0, 0.1));
    pointer-events: none;
    z-index: 2;
}

/* 首页卡片特殊效果 */
.homepage .game-card,
.homepage .news-card,
.homepage .lottery-card {
    backdrop-filter: blur(5px);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* 首页 SSR 首屏资讯卡片：结构与客户端卡片不同，需在 JS 接管前固定缩略图尺寸 */
.homepage .news-card.seo-initial-card .news-image {
    flex: 0 0 120px;
    width: 120px;
    height: 80px;
    margin-right: 15px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background-color: var(--color-bg-lighter);
}

.homepage .news-card.seo-initial-card .news-image img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
}

.homepage .news-card.seo-initial-card .news-info {
    flex: 1;
    min-width: 0;
    height: 80px;
    overflow: hidden;
}

.homepage .news-card.seo-initial-card .news-title {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--color-text-primary);
}

.homepage .news-card.seo-initial-card .news-info > p {
    display: none;
}

.homepage .news-card.seo-initial-card .news-date {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

/* 首页标题特效 */
.homepage .section-title {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.homepage .section-title:after {
    background: linear-gradient(45deg, var(--color-primary), #ff6600);
}
