/* 基础样式重置和优化 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    font-display: swap;
}

/* 改进图片加载性能 */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 顶部导航样式 - 优化SEO和可访问性 */
.header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    margin-right: 20px;
    text-decoration: none;
    color: inherit;
}

.logo-img {
    height: 40px;
    width: auto;
    margin-right: 10px;
    border-radius: 4px;
}

.site-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: #e74c3c;
}

/* 搜索框样式优化 */
.search-container {
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
    position: relative;
}

.search-box {
    position: relative;
    display: flex;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: #fff;
}

.search-input:focus {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 5px;
    background: #e74c3c;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.2s;
}

.search-btn:hover, 
.search-btn:focus {
    background: #c0392b;
    transform: scale(1.05);
}

/* 导航菜单样式 */
.nav-menu {
    display: flex;
    gap: 10px;
}

.nav-btn {
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    outline: none;
}

.nav-btn.active, 
.nav-btn:hover,
.nav-btn:focus {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

/* 主内容区样式优化 */
.main-content {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

/* 搜索结果样式优化 */
.search-results {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s ease;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.results-header h2 {
    color: #333;
    font-size: 1.2rem;
    margin: 0;
}

.results-count {
    color: #666;
    font-size: 0.9rem;
}

.clear-search {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.3s;
}

.clear-search:hover {
    background: #c0392b;
}

/* 视频网格样式优化 */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.video-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.video-card:hover,
.video-card:focus {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    color: inherit;
    outline: none;
}

.video-thumbnail {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background-color: #f5f5f5;
    transition: transform 0.3s;
}

.video-card:hover .video-thumbnail {
    transform: scale(1.05);
}

.video-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: calc(100% - 160px);
}

.video-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.video-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.ingredients-preview {
    color: #888;
    font-size: 0.8rem;
    margin-top: auto;
}

.highlight {
    background-color: #ffeb3b;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: bold;
}

/* 无结果提示样式优化 */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    grid-column: 1 / -1;
}

.no-results-content svg {
    color: #ddd;
    margin-bottom: 20px;
}

.no-results h2 {
    margin-bottom: 10px;
    font-size: 1.5rem;
}

/* 回到顶部按钮样式优化 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
}

.back-to-top.show {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.back-to-top:hover,
.back-to-top:focus {
    background: #c0392b;
    transform: scale(1.1);
    outline: none;
}

/* 加载指示器样式 */
.loading-indicator {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #e74c3c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #666;
}
.loading-text {
    color: #666;
}

/* 没有更多视频提示样式 */
.no-more-videos {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: #666;
}

.no-more-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.no-more-content svg {
    color: #4CAF50;
}

/* 页脚样式优化 */
.site-footer {
    background: #333;
    color: #fff;
    padding: 20px 0;
    margin-top: 40px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.beian-link {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s;
}

.beian-link:hover {
    text-decoration: underline;
    color: #e74c3c;
}


/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* 响应式设计优化 */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 15px;
        padding: 10px 15px;
    }
    
    .search-container {
        max-width: 100%;
        margin: 0;
        order: 3;
        width: 100%;
    }
    
    .nav-menu {
        order: 2;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
    
    .video-card {
        margin-bottom: 15px;
    }
    
    .video-thumbnail {
        height: 140px;
    }
    
    .video-content {
        padding: 12px;
    }
    
    .main-content {
        padding: 0 10px;
    }
    
    .nav-container {
        padding: 10px;
    }
}

/* 打印样式优化 */
@media print {
    .back-to-top,
    .search-container,
    .nav-menu {
        display: none !important;
    }
    
    .video-card {
        break-inside: avoid;
        margin-bottom: 20px;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .video-thumbnail {
        height: 120px;
    }
    
    .header {
        position: static;
        box-shadow: none;
        border-bottom: 1px solid #ddd;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .video-card {
        border: 2px solid #000;
    }
    
    .nav-btn.active {
        border-width: 2px;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}