/* ==========================================================================
   1. Reset & Base Styles (基础重置)
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f4f5f7;
    color: #333;
    line-height: 1.6;
    font-size: 14px;
}

a {
    text-decoration: none;
    color: #333;
    transition: color 0.2s, opacity 0.2s;
}

a:hover {
    color: #007bff;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   2. Layout Structure (布局容器)
   ========================================================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.main-content {
    min-height: 60vh;
    padding-bottom: 10px;
}

/* ==========================================================================
   3. Header (头部)
   ========================================================================== */
.site-header {
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    padding: 8px 0;
    margin-bottom: 15px;
    position: sticky; /* 头部吸顶可选 */
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo h1 {
    font-size: 24px;
    color: #007bff;
    font-weight: 700;
    margin: 0;
}

.logo img {
    max-height: 40px;
}

.nav-menu ul {
    display: flex;
    gap: 20px;
    margin: 0;
}

.nav-menu a {
    font-weight: 600;
    font-size: 16px;
    padding: 5px 0;
    position: relative;
}

.nav-menu .current a::after,
.nav-menu a:hover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #007bff;
}

.search-box {
    display: flex;
    align-items: center;
}

.search-form {
  position: relative;
  max-width: 160px;
  margin: 2px auto;
}

.search-input {
  width: 100%;
  padding: 5px 20px 5px 11px;    /* 给右侧按钮留空间 */
  border: 1px solid #e5e7eb;
  border-radius: 30px;              /* 圆角，椭圆形状 */
  outline: none;
  font-size: 16px;
  box-sizing: border-box;
  background: #fff;
}

.search-btn {
  position: absolute;
  right: 1px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: #eee;
  color: #333;
  padding: 0 12px;
  height: 28px;
  border-radius: 18px;              /* 椭圆按钮 */
  font-size: 17px;
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 鼠标悬停效果，可选 */
.search-btn:hover {
  background: #dedede;
}

/* ==========================================================================
   4. Video Grid (视频列表 - 首页/分类/热门)
   ========================================================================== */
.video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 默认3列 */
    gap: 20px;
    margin-bottom: 5px;
}

.video-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

/* 缩略图容器 - 16:9 比例 */
.video-thumb {
    position: relative;
    display: block;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    overflow: hidden;
    background: #000;
}

.video-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* 填满容器 */
    opacity: 0.95;
    transition: opacity 0.3s;
}

.video-card:hover .video-thumb img {
    opacity: 1;
}

/* 播放图标 */
.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    color: #fff;
    font-size: 40px;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
}

.video-card:hover .play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* 右下角热度标签 */
.view-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    backdrop-filter: blur(2px);
}

/* 视频标题 */
.video-title {
    padding: 8px 10px;
    margin: 0;
    font-size: 15px;
    line-height: 1.4;
    height: 66px; /* 限制高度 */
    overflow: hidden;
}

.video-title a {
    display: block;
    color: #333;
    /* 多行文本省略 - 限制显示2行 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   5. Post Content (文章内容页)
   ========================================================================== */
.post-content {
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 5px;
}

.post-title {
    font-size: 26px;
    margin-bottom: 15px;
    color: #222;
}

.post-tags {
    font-size: 13px;
    color: #888;
    margin-bottom: 5px;
}

.post-tags a {
    color: #666;
    background: #eee;
    padding: 2px 8px;
    border-radius: 3px;
    margin-right: 5px;
}

.video-player-wrapper {
    margin-bottom: 8px;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
}

/* 视频容器自适应 */
.video-player-wrapper iframe, 
.video-player-wrapper video,
.video-player-wrapper embed {
    width: 100%;
    height: 630px; /* 默认桌面高度 */
    border: none;
    display: block;
}

.post-meta {
    border-top: 1px solid #f0f0f0;
    padding-top: 10px;
    font-size: 14px;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.post-meta span {
    display: inline-flex;
    align-items: center;
}

/* ==========================================================================
  /* --- 猜你喜欢 (随机视频) 图片强制统一比例 --- */
.related-videos {
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    margin-top: 5px;
}

.random-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 强制一行3个 */
    gap: 15px;
}

.random-item {
    display: block;
    width: 100%;
}

.random-item .img-box {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 关键：强制 16:9 比例 (9/16 = 0.5625) */
    overflow: hidden;
    border-radius: 4px;
    background: #f0f0f0; /* 图片未加载时的背景色 */
}

.random-item .img-box img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* 关键：填满容器，多余部分裁切，不变形 */
    transition: transform 0.3s ease;
}

.random-item:hover .img-box img {
    transform: scale(1.05); /* 鼠标悬停轻微放大特效 */
}

.random-item h4 {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.4;
    height: 40px; /* 限制标题高度，保证对齐 */
    overflow: hidden;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 最多显示2行标题 */
    -webkit-box-orient: vertical;
}

/* 404页面样式 */
.error-page {
    text-align: center;
    padding: 80px 0;
    background: #fff;
    border-radius: 8px;
    margin: 20px auto;
}
.error-code {
    font-size: 120px;
    font-weight: bold;
    color: #e0e0e0;
    line-height: 1;
}
.error-msg {
    font-size: 24px;
    margin: 20px 0;
    color: #333;
}
.error-back-btn {
    display: inline-block;
    margin-top: 30px;
    padding: 10px 30px;
    background: #007bff;
    color: #fff;
    border-radius: 50px;
    transition: background 0.2s;
}
.error-back-btn:hover {
    background: #0056b3;
    color: #fff;
}
/* 手机端适配调整 */
@media (max-width: 768px) {
    .random-grid {
        grid-template-columns: repeat(2, 1fr); /* 手机端一行显示2个，避免太小 */
        gap: 10px;
    }
}

/* ==========================================================================
   7. Hot Page Navigation (热门页筛选)
   ========================================================================== */
.hot-nav {
    margin-bottom: 25px;
    text-align: center;
}

.hot-nav a {
    display: inline-block;
    padding: 8px 25px;
    background: #fff;
    margin: 0 5px;
    border-radius: 20px;
    border: 1px solid #ddd;
    color: #555;
    font-size: 14px;
    transition: all 0.2s;
}

.hot-nav a:hover {
    border-color: #007bff;
    color: #007bff;
}

.hot-nav a.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
    box-shadow: 0 4px 10px rgba(0,123,255,0.3);
}

/* ==========================================================================
   8. Pagination (分页)
   ========================================================================== */
.pagination {
    text-align: center;
    margin-top: 40px;
}

/* 标准分页 (数字列表) */
.page-navigator {
    display: inline-flex;
    gap: 8px;
    padding: 0;
}

.page-navigator li {
    display: inline-block;
}

.page-navigator a, 
.page-navigator span {
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #555;
}

.page-navigator a:hover {
    border-color: #007bff;
    color: #007bff;
}

.page-navigator .current span {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

/* 简单分页 (上一页/下一页 - 热门页使用) */
.page-navigator.simple-pager {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.page-navigator.simple-pager li a,
.page-navigator.simple-pager li span {
    padding: 10px 35px; /* 加宽按钮 */
    font-weight: bold;
    font-size: 15px;
}

.page-navigator.simple-pager li.disabled span {
    background: #f0f0f0;
    color: #bbb;
    border-color: #eee;
    cursor: not-allowed;
}

.page-navigator.simple-pager li a {
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.page-navigator.simple-pager li a:hover {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,123,255,0.2);
}

/* ==========================================================================
   9. Footer (页脚)
   ========================================================================== */
.site-footer {
    text-align: center;
    padding: 15px 0;
    color: #999;
    font-size: 13px;
    background: #fff;
    margin-top: 10px;
    border-top: 1px solid #eee;
}

.site-footer a {
    color: #666;
}

/* ==========================================================================
   10. Responsive Media Queries (自适应)
   ========================================================================== */
/* =========================================
   平板 (Tablet) 和 手机 (Mobile) 适配
   范围：小于 1024px
   ========================================= */
@media (max-width: 1024px) {
    
    /* 1. 隐藏 Logo (包括图片Logo和文字Logo) */
    .logo {
        display: none;
    }}
@media (max-width: 992px) {
    /* 平板竖屏 */
    .video-grid {
        grid-template-columns: repeat(2, 1fr); /* 2列 */
    }
}

@media (max-width: 768px) {
    /* 手机端 */
    .header-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .logo {
        text-align: center;
    }
    
    .nav-menu ul {
        justify-content: center;
        flex-wrap: wrap;
        font-size: 14px;
    }
    

    .video-grid {
        grid-template-columns: 1fr; /* 1列 */
    }

    .video-player-wrapper iframe, 
    .video-player-wrapper video {
        height: 240px; /* 手机端视频高度减小 */
    }

    .random-grid {
        grid-template-columns: 1fr; /* 手机端猜你喜欢单列 */
    }
    
    .post-content {
        padding: 15px;
    }
    
    .post-title {
        font-size: 20px;
    }

    .page-navigator.simple-pager li a, 
    .page-navigator.simple-pager li span {
        padding: 8px 20px;
        font-size: 13px;
    }
}
