/* ========== 详情页整体容器 ========== */
.detail-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 15px 3%;
}

/* ========== 主图 + 信息（左右排列） ========== */
.detail-top {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    margin-bottom: 25px;
    width: 100%;
}
.detail-main-image {
    flex: 0 0 45%;
    max-width: 520px;
    min-width: 250px;
}
.detail-main-image img {
    width: 100%;
    border-radius: 8px;
    background: #1a1a1a;
    cursor: pointer;
    transition: opacity 0.2s;
}
.detail-main-image img:hover {
    opacity: 0.9;
}
.detail-info {
    flex: 1;
    padding-left: 15px;
}
.detail-info h1 {
    font-size: 0.8rem;
    color: #915;
    margin: 0 0 0px;        /* 10px → 6px */
}
.di-code {
    color: #aaa;
    font-size: 0.85rem;
    margin-bottom: 0px;     /* 10px → 6px */
}
.di-specs p {
    color: #ccc;
    margin: 1px 2px;     
    font-size: 0.85rem;     /* 3px → 1px */
}
.di-price {
    font-size: 0.65rem;
    color: #ccc;
    font-weight: bold;
    margin-top: 0px;        /* 12px → 8px */
}
.di-reviews {
    color: #888;
    margin-top: 5px;        /* 5px → 3px */
}
/* ========== 通用区块标题 ========== */
.detail-block {
    margin-top: 30px;
    border-top: 1px solid #333;
    padding-top: 20px;
}
.detail-block h2 {
    font-size: 1.2rem;
    color: #0f0;
    border-left: 4px solid #0f0;
    padding-left: 10px;
    margin: 0 0 15px;
}

/* ========== 商品图片网格（四列） ========== */
.image-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.thumb-img {
    width: 100%;
    aspect-ratio: 1 / 1.3;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
}
.thumb-img:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

/* ========== 视频缩略图 ========== */
.video-thumbs {
    display: flex;
    gap: 15px;
    justify-content: center;
}
.video-thumbs.single {
    justify-content: center;
}
.video-thumb {
    width: 200px;
    aspect-ratio: 16/9;
    background: #1a1a1a;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}
.video-thumb:hover {
    background: #2a2a2a;
}
.video-icon {
    font-size: 2.5rem;
    color: white;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

/* ========== 商品说明（两列列表） ========== */
.desc-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 20px;
    list-style: none;
    padding: 0;
    margin: 0;
}
.desc-list li {
    color: #ccc;
    padding: 6px 0;
    border-bottom: 1px solid #2a2a2a;
    font-size: 0.95rem;
}

/* ========== 链接图（2×2） - 修复不裁切无留白 ========== */
.link-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-width: 400px; /* 稍微限制最大宽度，保持紧凑 */
    margin: 0 auto;
    align-items: start; /* 高度自适应时顶部对齐 */
}
.link-card {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a1a;
    transition: 0.2s;
}
.link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,255,0,0.2);
}
/* 完美显示：宽度占满容器，高度自适应，不拉伸不裁切 */
.link-card img {
    width: 100%;
    height: auto;
    display: block;
}

/* ========== 其他推荐网格（四列） ========== */
.recommend-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.recommend-card {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a1a;
    transition: 0.2s;
}
.recommend-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,255,0,0.2);
}
.recommend-card img {
    width: 100%;
    aspect-ratio: 1 / 1.3;
    object-fit: cover;
    display: block;
}

/* ========== 统一图片画廊模态框 (去重整合版) ========== */
.gallery-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 999;
    justify-content: center;
    align-items: center;
}
.gallery-modal.active {
    display: flex;
}
.gallery-content {
    position: relative;
    max-width: 80%;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gallery-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
}
.gallery-counter {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    color: #aaa;
    font-size: 0.9rem;
}
/* 切换箭头 */
.gallery-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    font-size: 2.5rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: background 0.2s;
}
.gallery-nav:hover {
    background: rgba(0,0,0,0.9);
}
.gallery-nav.prev { left: 20px; }
.gallery-nav.next { right: 20px; }

/* 关闭按钮 */
.close-modal {
    position: fixed;
    top: 20px; right: 30px;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    z-index: 1000;
}

/* ========== 视频播放模态框 ========== */
.video-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1001;
    justify-content: center;
    align-items: center;
}
.video-modal.active {
    display: flex;
}
.video-modal-content {
    position: relative;
    max-width: 80%;
    max-height: 80vh;
}
.video-modal-content video {
    width: 100%;
    max-height: 80vh;
    border-radius: 8px;
}

/* ========== 手机端适配 ========== */
@media (max-width: 768px) {
    .detail-container {
        padding: 10px 2%;
    }
    .detail-top {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 12px;
    }
    .detail-main-image {
        flex: 0 0 140px;
        max-width: 140px;
        min-width: 140px;
    }
    .detail-info {
        padding-left: 0;
    }
    .image-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .recommend-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .gallery-nav {
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }
    .gallery-nav.prev { left: 10px; }
    .gallery-nav.next { right: 10px; }
    .close-modal {
        top: 10px; right: 20px;
    }
    .video-thumb {
        width: 140px;
    }
}
/* ========== 链接图（2×2） - 与后台保持一致 ========== */
.link-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-width: 400px; /* 保持紧凑 */
    margin: 0 auto;
}
.link-card {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80px;               /* 固定卡片高度，确保2x2网格整齐 */
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a1a;
    transition: 0.2s;
}
.link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,255,0,0.2);
}
.link-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;        /* 关键：保证图片完整显示，不裁切、不变形、居中 */
    display: block;
}
.desc-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 20px;
    padding: 0;
    margin: 0;
}
.desc-list li {
    list-style-type: square;          /* 实心小方块 */
    list-style-position: inside;      /* 标记放在文字内部，避免对齐问题 */
    color: #ccc;
    padding: 6px 0;
    border-bottom: 1px solid #2a2a2a;
    font-size: 0.95rem;
}
/* 评论模块 */
.comment-section h3 { color: #0f0; }
.comment-list { margin: 15px 0; }
.comment-item {
    background: #1a1a1a;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
}
.ci-meta { margin-bottom: 5px; }
.ci-nickname { color: #0f0; font-weight: bold; }
.ci-date { color: #888; font-size: 0.8rem; margin-left: 10px; }
.ci-content { color: #ccc; line-height: 1.5; }
.reply-btn {
    background: none;
    border: 1px solid #444;
    color: #aaa;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 5px;
}
.sub-comments {
    margin-left: 20px;
    border-left: 2px solid #333;
    padding-left: 10px;
    margin-top: 5px;
}
.comment-item.sub {
    background: #222;
    margin-top: 5px;
}
.comment-form label {
    display: block;
    margin: 8px 0 4px;
    color: #ccc;
}
.comment-form input, .comment-form textarea {
    width: 100%;
    padding: 8px;
    background: #222;
    border: 1px solid #444;
    color: #eee;
    border-radius: 4px;
    font-size: 0.9rem;
}
.comment-form button {
    margin-top: 10px;
    padding: 8px 20px;
    background: #0f0;
    color: #000;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}
.video-thumb{
    position: relative;
    width: 220px;
    height: 140px;
    overflow: hidden;
    border-radius: 10px;
    background: #000;
    cursor: pointer;
}

.video-preview{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-icon{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    width: 50px;
    height: 50px;
    line-height: 50px;

    border-radius: 50%;
    background: rgba(0,0,0,.6);
    color: #fff;
    text-align: center;
    font-size: 22px;

    pointer-events: none;
}