/* --- 全局基础样式 --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #f0f2f5; /*稍微加深一点背景色，更有质感*/
    color: #333;
}

/* --- 头部样式 --- */
header {
    background-color: #fff;
    padding: 15px 20px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}
header h1 { margin: 0 0 15px 0; font-size: 1.8em; }

/* --- 搜索表单 (紧凑型) --- */
.search-form {
    display: flex;
    justify-content: center;
    max-width: 400px; /* 限制宽度 */
    margin: 0 auto;
}
.search-form input[type="search"] {
    width: 100%;
    padding: 6px 15px; /* 减小内边距，让高度变窄 */
    font-size: 0.95em;
    border: 1px solid #ccc;
    border-radius: 20px 0 0 20px;
    outline: none;
    transition: border-color 0.2s;
}
.search-form input[type="search"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.25);
}
.search-form button {
    padding: 6px 20px; /* 必须与 input 的 padding 保持一致 */
    font-size: 0.95em;
    border: 1px solid #007bff;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    border-radius: 0 20px 20px 0;
    border-left: none;
    transition: background-color 0.2s;
}
.search-form button:hover {
    background-color: #0056b3;
}

/* --- 主内容区域 --- */
main { padding: 20px; }

/* --- 视频网格布局 --- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- 视频卡片样式 --- */
.video-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}
.video-card:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 8px 16px rgba(0,0,0,0.12); 
}
.video-card img.thumbnail { 
    width: 100%; 
    aspect-ratio: 16 / 9; 
    object-fit: cover; 
    display: block; 
    background-color: #eee;
}
.video-card .info { padding: 12px 15px; }
.video-card .title { 
    font-size: 1.05em; 
    font-weight: 600; 
    margin: 0 0 8px 0; 
    display: -webkit-box; 
    -webkit-box-orient: vertical; 
    overflow: hidden; 
    line-height: 1.4;
}
.video-card .date { 
    font-size: 0.85em; 
    color: #888; 
    margin: 0; 
}

/* --- 加载动画 --- */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
    margin: 30px auto;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- 无结果提示 --- */
.no-results {
    text-align: center;
    font-size: 1.1em;
    color: #666;
    margin-top: 40px;
}

/* --- 播放页容器样式 --- */
.player-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.player-container {
    width: 100%;
    max-width: 1000px; /* 播放器最大宽度 */
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
#player-con {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
}

/* --- 播放页详情样式 --- */
.video-details {
    width: 100%;
    max-width: 1000px;
    background-color: #fff;
    padding: 25px;
    margin-top: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    box-sizing: border-box; /* 确保padding不会撑大宽度 */
}
.video-details h1 {
    font-size: 1.6em;
    margin: 0 0 10px 0;
    color: #222;
}
.meta-info {
    font-size: 0.9em;
    color: #777;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}
.description-text {
    font-size: 1em;
    color: #444;
    line-height: 1.6;
    white-space: pre-wrap; /* 保留后端传过来的换行符 */
}