/* 游戏详情页专用样式 */

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* CSS变量定义 - 用于简化复杂计算 */
:root {
    --sidebar-width: 300px;
    --info-panel-width: 400px;
    --container-padding: 4rem;
    --content-padding: 2rem;
    --comment-padding: 10rem;
}

/* 顶部栏 */
.game-detail-page .top-bar {
    display: none; /* 桌面端默认隐藏 */
}

.game-detail-page .mobile-menu-btn {
    display: none; /* 桌面端隐藏移动菜单按钮 */
}

/* 游戏详情容器 */
.game-detail-container {
    display: flex;
    gap: 2rem;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* 游戏画廊区域 */
.game-gallery {
    flex: 1;
    max-width: 800px;
    min-width: 0;
    overflow: hidden;
    width: 100%;
    flex-basis: 0;
    flex-grow: 1;
    flex-shrink: 1;
}

/* 主海报 */
.main-poster {
    position: relative;
    width: 100%;
    height: 450px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.main-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.poster-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(transparent 60%, rgba(0,0,0,0.8) 100%);
    padding: 2rem;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.game-title-main {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    max-width: 100%;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.game-meta-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 100%;
    overflow: hidden;
}

.meta-badge {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    backdrop-filter: blur(10px);
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* 详情图集 */
.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);  /* 统一使用变量 */
    margin-bottom: 2rem;
}

.album-item {
    position: relative;
    height: 150px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.album-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.3);
}

.album-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.album-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.album-item:hover .album-overlay {
    opacity: 1;
}

.album-overlay i {
    color: white;
    font-size: 2rem;
}

/* 游戏信息面板 */
.game-info-panel {
    flex: 0 0 400px;
    background: #0a0a0a;
    border-radius: 2px;
    padding: 8px;
    height: fit-content;
    border: 1px solid #1a1a1a;
}

.info-section {
    margin-bottom: 8px;
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--sidebar-text-primary);
}

.info-grid {
    display: grid;
    gap: 3px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background: #000000;
    border-radius: 2px;
    border: 1px solid #1a1a1a;
    transition: background 0.15s, border-color 0.15s;
    min-height: 26px;
}

.info-item:hover {
    background: #1a1a1a;
    border-color: #7D2BA8;
}

.info-label {
    color: #8f98a0;
    font-size: 0.875rem;
}

.info-value {
    color: #c7d5e0;
    font-weight: 500;
}

/* 价格和兑换区域 - 暗色设计 */
.price-section {
    text-align: center;
    padding: 10px;
    background: #0a0a0a;
    border-radius: 2px;
    margin-bottom: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: none;
    transition: background 0.15s, border-color 0.15s;
    border: 1px solid #1a1a1a;
}

.price-section:hover {
    background: #1a1a1a;
    border-color: #7D2BA8;
    transform: none;
    box-shadow: none;
}

.price-label {
    color: #8f98a0;
    font-size: 0.9rem;
    margin-bottom: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.price-value {
    color: #cdaa5e;
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 10px;
    text-shadow: none;
}

/* 兑换按钮 - 使用 button-base.css 基础样式，统一主页面配色 */
.exchange-btn {
    /* 基础样式来自 .button-base .button-full-width */
    width: 100%;
    padding: 1rem 2rem;
    background: transparent;
    color: var(--text-primary);
    border-radius: 2px;
    font-weight: 600;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    transition: background 0.15s, border-color 0.15s;
}

.exchange-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.exchange-btn:disabled {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

/* 下载区域样式 - 暗色设计 */
.download-content {
    background: #0a0a0a;
    border-radius: 2px;
    margin-bottom: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: none;
    transition: background 0.15s, border-color 0.15s;
    border: 1px solid #1a1a1a;
    padding: 8px;
}

.download-content:hover {
    background: #1a1a1a;
    border-color: #7D2BA8;
    transform: none;
    box-shadow: none;
}

.download-content .info-title {
    color: #c7d5e0;
    padding: 0 0 6px 0;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.download-content .info-title i {
    color: #7D2BA8;
    font-size: 1.2rem;
    background: transparent;
    padding: 0;
    border-radius: 0;
    backdrop-filter: none;
}

.download-info {
    background: #000000;
    border: 1px solid #1a1a1a;
    border-radius: 2px;
    padding: 8px;
    backdrop-filter: none;
    position: relative;
    z-index: 3;
}

/* 下载分页控制器 */
.download-pagination {
    background: #000000;
    padding: 1rem 1.5rem;
    border-radius: 2px;
    margin-bottom: 1rem;
    border: 1px solid #1a1a1a;
    position: relative;
    z-index: 2;
}

.download-pagination-info {
    color: #c7d5e0;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 1rem;
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
}

.game-detail-page .download-pagination .pagination-btn {
    background: transparent;
    color: #c7d5e0;
    border: 1px solid #1a1a1a;
    border-radius: 2px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    backdrop-filter: none;
    min-width: 40px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-detail-page .download-pagination .pagination-btn:hover:not(:disabled) {
    background: #1a1a1a;
    border-color: #7D2BA8;
    transform: none;
    box-shadow: none;
}

.game-detail-page .download-pagination .pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.page-indicator {
    color: #c7d5e0;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0 2px;
    background: #000000;
    border-radius: 2px;
    border: 1px solid #1a1a1a;
    min-width: 60px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-links-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

/* 下载链接按钮 - 暗色设计 */
.download-link {
    /* 基础样式来自 .button-base */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: transparent;
    color: #c7d5e0;
    padding: 4px;
    border-radius: 2px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    text-align: center;
    min-height: 44px;
    border: 1px solid #1a1a1a;
    transition: background 0.15s, border-color 0.15s;
    position: relative;
    z-index: 10;
    cursor: pointer;
    backdrop-filter: none;
}

.download-link:hover {
    transform: none;
    box-shadow: none;
    color: #c7d5e0;
    background: #1a1a1a;
    border-color: #7D2BA8;
}

.download-link:active {
    transform: none;
}

/* 内容标签页 */
.content-tabs {
    margin-top: 2rem;
    width: 100%;
    min-width: 0; /* 确保flex容器不会撑破 */
}

.tab-nav {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
    position: relative;
    width: 100%;
}

/* 标签按钮 - 使用 button-base.css 基础样式，统一主页面配色 */
.tab-btn {
    /* 特殊的按钮样式，继承 .button-base 的基础行为 */
    padding: 1rem 2rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    position: relative;
    flex-shrink: 0;
    transition: all var(--transition-normal);
}

.tab-btn:hover:not(.active) {
    color: white;
    background-color: #242525;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: transparent;
}

.tab-content {
    display: none;
    width: 100%;
    min-width: 0; /* 防止内容撑破容器 */
    overflow: hidden; /* 防止内容溢出 */
}

.tab-content.active {
    display: block;
}

.game-description {
    line-height: 1.6;
    color: var(--text-primary);
}

/* 评论区域 */
.comments-section {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
    contain: layout;
}

.comment-form {
    background: var(--bg-hover);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    contain: layout;
}

.comment-input {
    width: 100%;
    min-height: 100px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: var(--bg-card);
    color: var(--text-primary);
    resize: vertical;
    margin-bottom: 1rem;
    box-sizing: border-box;
    overflow: hidden;
}

/* 评论提交按钮 - 使用 button-base.css 基础样式，统一主页面配色 */
.comment-submit {
    /* 基础样式来自 .button-base .button-submit */
    background: transparent;
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 2px;
    font-weight: 500;
    max-width: 200px; /* 限制按钮宽度 */
    width: auto;
    flex-shrink: 0; /* 防止按钮被压缩 */
    border: 1px solid var(--border-color);
    transition: background 0.15s, border-color 0.15s;
}

.comment-submit:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.comment-item {
    background: var(--bg-hover);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    contain: layout;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: pre-wrap;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.comment-author {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-date {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.comment-content {
    color: var(--text-primary);
    line-height: 1.5;
    max-width: 100%;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: pre-wrap;
}

/* 评论翻页样式 */
.comments-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem;
}

/* 分页按钮 - 使用 button-base.css 基础样式，统一主页面配色 */
.game-detail-page .comments-pagination .pagination-btn {
    /* 基础样式来自 .button-base .button-pagination */
    padding: 0.5rem 1rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-normal);
}

.game-detail-page .comments-pagination .pagination-btn:hover:not(:disabled) {
    background: #242525;
    color: white;
    border-color: #242525;
}

.game-detail-page .comments-pagination .pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0 1rem;
}

/* PC端媒体查询 - 确保布局约束只在桌面端生效 */
@media (min-width: 1024px) {
    .game-detail-container {
        max-width: calc(100vw - var(--sidebar-width) - var(--container-padding));
        overflow: hidden;
    }
    
    .game-gallery {
        flex-basis: 0;
        flex-grow: 1;
        flex-shrink: 1;
        overflow: hidden;
        max-width: calc(100vw - var(--sidebar-width) - var(--info-panel-width) - 6rem);
    }
    
    .comments-section {
        max-width: calc(100vw - var(--sidebar-width) - var(--info-panel-width) - var(--comment-padding));
    }
    
    .comment-input {
        max-width: calc(100vw - var(--sidebar-width) - var(--info-panel-width) - var(--comment-padding));
    }
    
    .comment-item {
        max-width: calc(100vw - var(--sidebar-width) - var(--info-panel-width) - var(--comment-padding));
    }
    
    /* 强制所有子元素不能超出父容器 */
    .comments-section * {
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* 移动端响应式设计 */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
    
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        z-index: 2000;
        position: fixed;
        top: 0;
        left: 0;
        height: 100dvh;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .game-detail-page .top-bar {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: stretch;
        padding: var(--spacing-md) var(--spacing-lg);
        background: var(--bg-card);
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        z-index: 100;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    .game-detail-container {
        flex-direction: column;
        max-width: 100vw;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
        padding: 1rem;
        padding-bottom: 80px;
        gap: 1rem;
        overflow-x: hidden;
    }
    
    .game-detail-page .mobile-menu-btn {
        display: flex;
        width: 40px;
        height: 40px;
        border-radius: var(--radius-md);
    }
    
    .game-gallery {
        max-width: 100%;
        width: 100%;
        flex: none;
        box-sizing: border-box;
    }
    
    .main-poster {
        height: 300px;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .album-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .album-item {
        height: 120px;
        box-sizing: border-box;
    }
    
    .game-info-panel {
        flex: none;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .content-tabs {
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    .comments-section,
    .comment-input,
    .comment-item,
    .comment-form {
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    .tab-nav {
        overflow-x: auto;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .tab-btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    .comment-form,
    .comment-item {
        padding: var(--spacing-md);
        box-sizing: border-box;
    }
    
    .comment-input {
        min-height: 80px;
        padding: var(--spacing-sm);
        box-sizing: border-box;
    }
    
    /* 移动端弹层遮罩 */
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1999;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
    }
    
    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* 移动端下载按钮优化 */
    .download-links-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }
    
    .download-link {
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
        min-height: 40px;
    }
    
    /* 移动端分页控制器优化 */
    .download-pagination {
        padding: 0.75rem 1rem;
    }
    
    .download-pagination-info {
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
    }
    
    .pagination-controls {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 0.75rem;
    }
    
    .game-detail-page .download-pagination .pagination-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        min-width: 36px;
        height: 32px;
    }
    
    .page-indicator {
        font-size: 0.8rem;
        min-width: 50px;
        height: 32px;
        padding: 0 0.75rem;
    }
    
    .recommendations-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* 图片灯箱 */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.lightbox-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--primary-color);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

/* 移动端lightbox优化 */
@media (max-width: 768px) {
    .lightbox-content {
        padding: 1rem;
    }
    
    .lightbox-image {
        max-width: 95%;
        max-height: 85%;
    }
    
    .lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .lightbox-nav {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
    
    .lightbox-prev {
        left: 1rem;
    }
    
    .lightbox-next {
        right: 1rem;
    }
}

/* 推荐内容区域样式 */
.recommendations-section-wrapper {
    margin-top: 1rem;
}

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.recommendations-grid .game-card {
    margin: 0;
}
