/* 基础样式重置 - 确保所有浏览器默认样式一致 */
html, body {
  height: auto; /* 高度自动，根据内容撑开 */
  min-height: 100vh; /* 最小高度为视口高度，确保占满全屏 */
  overflow-x: hidden; /* 隐藏横向滚动条，防止内容横向溢出 */
}

/* 通用选择器重置 - 清除所有元素的默认边距和内边距 */
* {
    margin: 0; /* 外边距归零 */
    padding: 0; /* 内边距归零 */
    box-sizing: border-box; /* 盒模型设置为border-box，便于尺寸计算 */
}

/* 主体样式 - 设置页面基础样式 */
body {
    font-family: 'Arial', sans-serif; /* 设置字体族，优先使用Arial，降级使用系统无衬线字体 */
    background-color: #f8f8f8; /* 页面背景色为浅灰色 */
    color: #333; /* 主要文字颜色为深灰色 */
    line-height: 1.6; /* 行高为字体大小的1.6倍，提高可读性 */
    scroll-behavior: smooth; /* 启用平滑滚动效果 */
}

/* 顶部导航栏样式 */
.header {
    background: linear-gradient(to bottom, #003399, #FFFFFF); /* 从上到下的蓝色到白色渐变背景 */
    color: white; /* 文字颜色为白色 */
    padding: 15px 0; /* 上下内边距15px，左右0 */
    position: sticky; /* 粘性定位，滚动时固定在顶部 */
    top: 0; /* 距离顶部0px */
    z-index: 1000; /* 设置高层级，确保在其他内容之上 */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); /* 添加底部阴影，增加层次感 */
}

/* 导航容器布局 */
.nav-container {
    max-width: 1200px; /* 最大宽度限制，在大屏幕上不会过宽 */
    margin: 0 auto; /* 水平居中 */
    padding: 0 20px; /* 左右内边距20px */
    display: flex; /* 启用弹性布局 */
    justify-content: space-between; /* 子元素在主轴两端对齐 */
    align-items: center; /* 子元素在交叉轴居中对齐 */
    flex-wrap: wrap; /* 允许子元素换行 */
    gap: 15px; /* 子元素之间的间距 */
}

/* Logo区域样式 */
.logo {
    display: flex; /* 启用弹性布局 */
    align-items: center; /* 垂直居中对齐 */
    gap: 0px; /* 子元素间距为0 */
}

/* Logo图片样式 */
.logo-img {
    width: 40px; /* 固定宽度40px */
    height: 40px; /* 固定高度40px */
}

/* 网站名称样式 */
.site-name {
    font-size: 24px; /* 字体大小24px */
    font-weight: bold; /* 字体加粗 */
    align-self: flex-end; /* 自身在交叉轴底部对齐 */
}

/* 搜索容器样式 */
.search-container {
    position: relative; /* 相对定位，为子元素定位提供参考 */
    flex: 1; /* 弹性因子为1，占据剩余空间 */
    max-width: 400px; /* 最大宽度400px */
    margin: 0 20px; /* 左右外边距20px */
}

/* 搜索框整体样式 */
.search-box {
    position: relative; /* 相对定位 */
    display: flex; /* 启用弹性布局 */
    align-items: center; /* 垂直居中对齐 */
    background: white; /* 白色背景 */
    border-radius: 25px; /* 圆角边框，实现椭圆形状 */
    padding: 5px; /* 内边距5px */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); /* 添加阴影效果 */
}

/* 搜索输入框样式 */
.search-input {
    flex: 1; /* 占据剩余空间 */
    border: none; /* 无边框 */
    outline: none; /* 移除焦点轮廓 */
    padding: 12px 20px; /* 内边距：上下12px，左右20px */
    font-size: 16px; /* 字体大小16px */
    background: transparent; /* 透明背景 */
    border-radius: 25px; /* 圆角边框 */
    width: 100%; /* 宽度100% */
}

/* 搜索按钮样式 */
.search-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24); /* 135度对角线渐变背景 */
    border: none; /* 无边框 */
    border-radius: 50%; /* 圆形按钮 */
    width: 40px; /* 固定宽度 */
    height: 40px; /* 固定高度 */
    cursor: pointer; /* 鼠标悬停时显示手型光标 */
    display: flex; /* 启用弹性布局 */
    align-items: center; /* 垂直居中对齐 */
    justify-content: center; /* 水平居中对齐 */
    color: white; /* 文字颜色白色 */
    transition: all 0.3s ease; /* 所有属性过渡效果，时长0.3秒，缓动函数 */
    margin-left: 5px; /* 左边距5px */
}

/* 搜索按钮悬停效果 */
.search-btn:hover {
    transform: scale(1.1); /* 悬停时放大1.1倍 */
    box-shadow: 0 3px 10px rgba(238, 90, 36, 0.3); /* 添加阴影效果 */
}

/* 导航菜单样式 */
.nav-menu {
    display: flex; /* 启用弹性布局 */
    gap: 15px; /* 按钮间距15px */
}

/* 导航按钮基础样式 */
.nav-btn {
    background: rgba(255, 255, 255, 0.2); /* 半透明白色背景 */
    border: 2px solid transparent; /* 透明边框，为悬停效果预留空间 */
    color: #330066; /* 文字颜色深紫色 */
    padding: 8px 16px; /* 内边距：上下8px，左右16px */
    border-radius: 20px; /* 圆角边框 */
    cursor: pointer; /* 手型光标 */
    transition: all 0.3s ease; /* 过渡效果 */
    font-size: 16px; /* 字体大小 */
}

/* 导航按钮激活和悬停状态 */
.nav-btn.active,
.nav-btn:hover {
    background: white; /* 白色背景 */
    color: #ee5a24; /* 文字颜色橙色 */
    transform: translateY(-2px); /* 向上移动2px，产生悬浮效果 */
}

/* 主内容区域样式 */
.main-content {
    max-width: 1200px; /* 最大宽度限制 */
    margin: 20px auto; /* 上下外边距20px，水平居中 */
    padding: 0 20px; /* 左右内边距20px */
}

/* 搜索结果容器样式 */
.search-results {
    background: linear-gradient(135deg, #fff5f5, #fff0f0); /* 浅红色渐变背景 */
    border-radius: 15px; /* 圆角边框 */
    margin: 20px 0; /* 上下外边距20px */
    padding: 20px; /* 内边距20px */
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); /* 阴影效果 */
}

/* 搜索结果头部布局 */
.results-header {
    display: flex; /* 启用弹性布局 */
    align-items: center; /* 垂直居中对齐 */
    justify-content: space-between; /* 两端对齐 */
    margin-bottom: 20px; /* 底部外边距20px */
    flex-wrap: wrap; /* 允许换行 */
    gap: 15px; /* 元素间距 */
}

/* 搜索结果标题样式 */
.results-header h3 {
    color: #333; /* 文字颜色深灰色 */
    margin: 0; /* 清除默认外边距 */
}

/* 搜索结果计数样式 */
.results-count {
    background: #ee5a24; /* 橙色背景 */
    color: white; /* 白色文字 */
    padding: 4px 12px; /* 内边距 */
    border-radius: 15px; /* 圆角边框 */
    font-size: 14px; /* 字体大小 */
    font-weight: bold; /* 字体加粗 */
}

/* 清除搜索按钮样式 */
.clear-search {
    background: rgba(238, 90, 36, 0.1); /* 半透明橙色背景 */
    color: #ee5a24; /* 橙色文字 */
    border: 1px solid #ee5a24; /* 橙色边框 */
    padding: 8px 16px; /* 内边距 */
    border-radius: 20px; /* 圆角边框 */
    cursor: pointer; /* 手型光标 */
    transition: all 0.3s ease; /* 过渡效果 */
    font-size: 14px; /* 字体大小 */
}

/* 清除搜索按钮悬停效果 */
.clear-search:hover {
    background: #ee5a24; /* 橙色背景 */
    color: white; /* 白色文字 */
}

/* 视频网格布局 - 使用CSS Grid实现响应式布局 */
.video-grid {
    display: grid; /* 启用网格布局 */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* 自动填充列，最小300px，最大等分 */
    gap: 20px; /* 网格项间距20px */
    margin-top: 20px; /* 顶部外边距20px */
}

/* 视频卡片样式 */
.video-card {
    background: white; /* 白色背景 */
    border-radius: 15px; /* 圆角边框 */
    overflow: hidden; /* 隐藏溢出内容 */
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); /* 阴影效果 */
    transition: transform 0.3s ease; /* 变换过渡效果 */
    cursor: pointer; /* 手型光标 */
}

/* 视频卡片悬停效果 */
.video-card:hover {
    transform: translateY(-5px); /* 向上移动5px，产生悬浮效果 */
}

/* 视频缩略图样式 */
.video-thumbnail {
    width: 100%; /* 宽度100%填充容器 */
    height: 220px; /* 固定高度220px */
    object-fit: cover; /* 覆盖模式，保持比例填充 */
    display: block; /* 块级元素 */
}

/* 视频内容区域样式 */
.video-content {
    padding: 10px; /* 内边距10px */
}

/* 视频标题样式 */
.video-title {
    font-size: 18px; /* 字体大小18px */
    margin-bottom: 10px; /* 底部外边距10px */
    color: #333; /* 文字颜色深灰色 */
    display: -webkit-box; /* 使用旧版webkit盒模型，用于文本截断 */
    -webkit-line-clamp: 2; /* 最多显示2行 */
    -webkit-box-orient: vertical; /* 垂直方向排列 */
    overflow: hidden; /* 隐藏溢出文本 */
}

/* 视频描述样式 */
.video-description {
    color: #666; /* 文字颜色中灰色 */
    font-size: 14px; /* 字体大小14px */
    margin-bottom: 15px; /* 底部外边距15px */
    display: -webkit-box; /* 文本截断 */
    -webkit-line-clamp: 2; /* 最多2行 */
    -webkit-box-orient: vertical; /* 垂直排列 */
    overflow: hidden; /* 隐藏溢出 */
}

/* 配料预览样式 */
.ingredients-preview {
    font-size: 12px; /* 小字体 */
    color: #888; /* 浅灰色文字 */
    margin-bottom: 10px; /* 底部外边距 */
}

/* 预览购买按钮样式 */
.buy-btn-preview {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24); /* 渐变背景 */
    color: white; /* 白色文字 */
    border: none; /* 无边框 */
    padding: 8px 16px; /* 内边距 */
    border-radius: 20px; /* 圆角边框 */
    cursor: pointer; /* 手型光标 */
    width: 100%; /* 宽度100% */
    transition: all 0.3s ease; /* 过渡效果 */
    font-size: 14px; /* 字体大小 */
}

/* 预览购买按钮悬停效果 */
.buy-btn-preview:hover {
    transform: scale(1.05); /* 放大效果 */
    box-shadow: 0 3px 10px rgba(238, 90, 36, 0.3); /* 阴影效果 */
}

/* 无结果提示样式 */
.no-results {
    text-align: center; /* 文字居中对齐 */
    padding: 60px 20px; /* 内边距 */
    color: #666; /* 文字颜色 */
    grid-column: 1 / -1; /* 跨越所有网格列 */
}

/* 无结果内容样式 */
.no-results-content svg {
    color: #ddd; /* 图标颜色浅灰色 */
    margin-bottom: 20px; /* 底部外边距 */
}

/* 无结果标题样式 */
.no-results h3 {
    margin-bottom: 10px; /* 底部外边距 */
    color: #333; /* 文字颜色 */
}

/* 无结果描述样式 */
.no-results p {
    color: #888; /* 浅灰色文字 */
}

/* 回到顶部按钮样式 */
.back-to-top {
    position: fixed; /* 固定定位 */
    bottom: 15px; /* 距离底部15px */
    right: 10px; /* 距离右侧10px */
    width: 30px; /* 宽度30px */
    height: 30px; /* 高度30px */
    background: linear-gradient(to bottom, #003399, #FFFFFF); /* 渐变背景 */
    color: red; /* 文字颜色红色 */
    border: none; /* 无边框 */
    border-radius: 50%; /* 圆形按钮 */
    cursor: pointer; /* 手型光标 */
    display: none; /* 默认隐藏 */
    align-items: center; /* 垂直居中对齐 */
    justify-content: center; /* 水平居中对齐 */
    z-index: 999; /* 层级设置 */
    box-shadow: 0 4px 20px rgba(238, 90, 36, 0.3); /* 阴影效果 */
    transition: all 0.3s ease; /* 过渡效果 */
    opacity: 0; /* 初始透明度为0 */
    transform: translateY(10px); /* 初始位置下移10px */
}

/* 显示回到顶部按钮 */
.back-to-top.show {
    display: flex; /* 显示为弹性布局 */
    opacity: 1; /* 完全不透明 */
    transform: translateY(0); /* 回到原始位置 */
}

/* 回到顶部按钮悬停效果 */
.back-to-top:hover {
    background: linear-gradient(to bottom, #FFFFFF, #003399); /* 反向渐变 */
    transform: translateY(-2px); /* 向上移动2px */
}

/* 模态框样式 */
.modal {
    display: none; /* 默认隐藏 */
    position: fixed; /* 固定定位 */
    top: 2px; /* 距离顶部2px */
    left: 0; /* 距离左侧0 */
    width: 100%; /* 宽度100% */
    height: 100%; /* 高度100% */
    background: rgba(200,180,140,0.9); /* 半透明浅木色背景 */
    z-index: 2000; /* 高层级 */
    animation: fadeIn 0.3s ease; /* 淡入动画 */
}

/* 模态框内容区域 */
.modal-content {
    position: absolute; /* 绝对定位 */
    top: 50%; /* 距离顶部50% */
    left: 50%; /* 距离左侧50% */
    transform: translate(-50%, -50%); /* 居中定位 */
    background: #FFEBCD; /* 浅木色背景 */
    border-radius: 15px; /* 圆角边框 */
    width: 100%; /* 宽度100% */
    max-width: 800px; /* 最大宽度800px */
    max-height: 100vh; /* 最大高度为视口高度 */
    overflow-y: auto; /* 垂直方向滚动 */
}

/* 关闭按钮样式 */
.close-btn {
    position: absolute; /* 绝对定位 */
    top: 0px; /* 距离顶部0 */
    right: 0px; /* 距离右侧0 */
    font-size: 30px; /* 字体大小30px */
    color: white; /* 白色文字 */
    cursor: pointer; /* 手型光标 */
    z-index: 2100; /* 高层级 */
    background: rgba(0,0,0,0.5); /* 半透明黑色背景 */
    width: 30px; /* 宽度30px */
    height: 30px; /* 高度30px */
    border-radius: 50%; /* 圆形 */
    display: flex; /* 弹性布局 */
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
}

/* 视频容器样式 */
.video-container {
    position: relative; /* 相对定位 */
    width: 100%; /* 宽度100% */
    background: #FFEBCD; /* 浅木色背景 */
    border-radius: 15px 15px 0 0; /* 上边圆角，下边直角 */
    overflow: hidden; /* 隐藏溢出 */
}

/* 视频播放器样式 */
.video-player {
    top: 2px; /* 距离顶部2px */
    width: 100%; /* 宽度100% */
    height: auto; /* 高度自动 */
    max-height: 99vh; /* 最大高度为视口高度的99% */
    display: block; /* 块级元素 */
}

/* 视频信息区域 */
.video-info {
    padding: 0px; /* 无内边距 */
}

/* 模态框标题样式 */
.video-info h3 {
    margin-bottom: 0px; /* 无底部外边距 */
    margin: 1px 15px; /* 外边距设置 */
    color: #333; /* 文字颜色 */
}

/* 模态框描述样式 */
.video-info h5 {
    margin-bottom: 8px; /* 底部外边距 */
    margin: 1px 15px; /* 外边距设置 */
    color: #5C4033; /* 深棕色文字 */
}

/* 配料区域样式 */
.ingredients {
    margin: 15px 15px; /* 外边距设置 */
}

/* 配料标题样式 */
.ingredients h4 {
    margin-bottom: 8px; /* 底部外边距 */
    color: #666; /* 文字颜色 */
}

/* 配料列表样式 */
.ingredients ul {
    list-style: none; /* 无列表符号 */
    padding-left: 0; /* 左内边距为0 */
}

/* 配料列表项样式 */
.ingredients li {
    padding: 8px 0; /* 上下内边距8px */
    border-bottom: 1px solid #eee; /* 底部边框分割线 */
    display: flex; /* 弹性布局 */
    justify-content: space-between; /* 两端对齐 */
}

/* 购买按钮样式 */
.buy-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049); /* 绿色渐变背景 */
    color: white; /* 白色文字 */
    border: none; /* 无边框 */
    padding: 12px 30px; /* 内边距 */
    border-radius: 25px; /* 圆角边框 */
    cursor: pointer; /* 手型光标 */
    font-size: 16px; /* 字体大小 */
    width: 100%; /* 宽度100% */
    transition: all 0.3s ease; /* 过渡效果 */
    margin-top: 20px; /* 顶部外边距 */
}

/* 购买按钮悬停效果 */
.buy-btn:hover {
    transform: scale(1.05); /* 放大效果 */
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3); /* 阴影效果 */
}

/* 网站底部样式 */
.site-footer {
    background: linear-gradient(to bottom, #003399, #F0F0F0); /* 渐变背景 */
    color: #ecf0f1; /* 文字颜色 */
    padding: 30px 0; /* 上下内边距 */
    margin-top: 50px; /* 顶部外边距 */
    text-align: center; /* 文字居中 */
}

/* 底部内容布局 */
.footer-content {
    max-width: 1200px; /* 最大宽度 */
    margin: 0 auto; /* 水平居中 */
    padding: 0 20px; /* 左右内边距 */
    display: flex; /* 弹性布局 */
    justify-content: space-between; /* 两端对齐 */
    align-items: center; /* 垂直居中 */
    flex-wrap: wrap; /* 允许换行 */
    gap: 20px; /* 元素间距 */
}

/* 版权信息样式 */
.copyright p {
    margin: 0; /* 无外边距 */
    font-size: 14px; /* 字体大小 */
    color: #bdc3c7; /* 文字颜色 */
}

/* 备案链接样式 */
.beian-link {
    display: inline-block; /* 行内块元素 */
    padding: 8px 16px; /* 内边距 */
    background: rgba(255, 255, 255, 0.1); /* 半透明背景 */
    border-radius: 4px; /* 圆角边框 */
    color: #ecf0f1; /* 文字颜色 */
    text-decoration: none; /* 无下划线 */
    font-size: 14px; /* 字体大小 */
    transition: all 0.3s ease; /* 过渡效果 */
    border: 1px solid rgba(255, 255, 255, 0.2); /* 边框 */
}

/* 备案链接悬停效果 */
.beian-link:hover {
    background: rgba(255, 255, 255, 0.2); /* 背景变亮 */
    color: #ffffff; /* 文字颜色变白 */
    text-decoration: none; /* 无下划线 */
}

/* 搜索高亮样式 */
.highlight {
    background-color: #fff3cd; /* 浅黄色背景 */
    padding: 2px 4px; /* 内边距 */
    border-radius: 3px; /* 小圆角 */
    color: #e5533d; /* 红色文字 */
    font-weight: bold; /* 字体加粗 */
}

/* 淡入动画定义 */
@keyframes fadeIn {
    from { opacity: 0; } /* 开始状态：完全透明 */
    to { opacity: 1; } /* 结束状态：完全不透明 */
}

/* 懒加载相关样式 */
.no-more-videos {
    grid-column: 1 / -1; /* 跨越所有网格列 */
    text-align: center; /* 文字居中 */
    padding: 20px 10px; /* 内边距 */
    color: #888; /* 文字颜色 */
}

.no-more-content {
    display: flex; /* 弹性布局 */
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
    gap: 10px; /* 元素间距 */
}

.no-more-content svg {
    color: #003399; /* 绿色图标 */
    margin-bottom: 0; /* 无底部边距 */
    flex-shrink: 0; /* 防止图标被压缩 */
}

.no-more-content p {
    font-size: 16px; /* 字体大小 */
    margin: 0; /* 无外边距 */
}

/* 加载指示器样式 */
.loading-indicator {
    grid-column: 1 / -1; /* 跨越所有网格列 */
    text-align: center; /* 文字居中 */
    padding: 30px 20px; /* 内边距 */
    display: none; /* 默认隐藏 */
}

.loading-content {
    display: flex; /* 弹性布局 */
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
    gap: 15px; /* 元素间距 */
}

.loading-spinner {
    display: inline-block; /* 行内块元素 */
    width: 25px; /* 宽度 */
    height: 25px; /* 高度 */
    border: 3px solid #f3f3f3; /* 边框样式 */
    border-top: 3px solid #003399; /* 顶部边框颜色不同，用于旋转动画 */
    border-radius: 50%; /* 圆形 */
    animation: spin 1s linear infinite; /* 旋转动画 */
}

.loading-text {
    font-size: 16px; /* 字体大小 */
    color: #666; /* 文字颜色 */
    font-weight: 500; /* 字体粗细 */
}

/* 旋转动画定义 */
@keyframes spin {
    0% { transform: rotate(0deg); } /* 开始状态：0度旋转 */
    100% { transform: rotate(360deg); } /* 结束状态：360度旋转 */
}

/* 响应式设计 - 平板设备（最大宽度768px） */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column; /* 垂直排列 */
        gap: 15px; /* 元素间距 */
    }
    
    .search-container {
        order: 3; /* 调整显示顺序 */
        width: 100%; /* 宽度100% */
        max-width: 100%; /* 最大宽度100% */
        margin: 0; /* 无外边距 */
    }
    
    .search-box {
        margin: 0 10px; /* 左右外边距 */
    }
    
    .video-grid {
        grid-template-columns: 1fr; /* 单列布局 */
    }
    
    .modal-content {
        width: 95%; /* 宽度95% */
        margin: 20px auto; /* 居中显示 */
    }
    
    .footer-content {
        flex-direction: column; /* 垂直排列 */
        text-align: center; /* 文字居中 */
        gap: 15px; /* 元素间距 */
    }
    
    .back-to-top {
        bottom: 10px; /* 距离底部 */
        right: 10px; /* 距离右侧 */
        width: 35px; /* 宽度 */
        height: 35px; /* 高度 */
    }
    
    .results-header {
        flex-direction: column; /* 垂直排列 */
        align-items: flex-start; /* 左对齐 */
        gap: 5px; /* 元素间距 */
    }
    
    .loading-content {
        flex-direction: column; /* 垂直排列 */
        gap: 5px; /* 元素间距 */
    }
    
    .loading-spinner {
        width: 15px; /* 较小宽度 */
        height: 15px; /* 较小高度 */
    }
    
    .loading-text {
        font-size:12px;
    }
}