* {
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

p {
    margin-top: 0;
    margin-bottom: 0;
}

body {
    margin: 0;
    padding-top: 60px; /* 给固定的 header 留出空间 */
    padding-left: 180px; /* 给固定的 side-bar 留出空间 */
}

.head-bar {
    display: flex;
    flex-direction: row;
    padding: 10px;
    height: 60px;
    align-items: center;
    position: fixed; /* 固定定位 */
    top: 0;
    left: 0;
    right: 0;
    background-color: white; /* 防止透明背景导致内容重叠 */
    z-index: 100; /* 确保在最上层 */
    border-bottom: 1px solid #e5e5e5; /* 可选：加个底边框更好看 */
}

.head-bar .menu {
    width: 32px;
    margin-right: 20px;
}

.head-bar .messages {
    margin-right: 30px;
    position: relative;
}

.head-bar .youtube-logo {
    width: 100px;
    margin-right: 20px;
}

.search-bar {
    flex: 1;
    display: flex;
    justify-content: center;
}

.search-bar input {
    width: 50%;
    height: 36px; /* 强制固定高度 */
    padding: 0 8px; /* 上下padding设为0，靠height撑开 */
    font-size: 16px;
    border: 1px solid #9e9e9e;
    border-top-left-radius: 3px;
    border-bottom-left-radius: 3px;
    border-right: none; /* 移除右边框，避免双重边框 */
    box-sizing: border-box; /* 确保高度包含border */
    box-shadow: inset #dcdbdb 1px 1px 3px;
}

.search-bar input::placeholder {
    font-weight: 500;
}

.search-bar .search-button {
    width: 36px; /* 增加宽度，让它看起来像个按钮 */
    height: 36px; /* 确保高度和 input 一致 */
    padding: 6px; /* 给图标一点内边距 */
    /* align-self: center; */
    display: flex; /* 使用 flex 布局 */
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
    border: 1px solid #9e9e9e;
    border-top-right-radius: 3px;
    border-bottom-right-radius: 3px;
    background-color: #f8f8f8; /* 给按钮加个背景色 */
    box-sizing: border-box; /* 确保 padding 不会撑大盒子 */
}

.search-bar .search-button:hover {
    background-color: #f0f0f0;
    cursor: pointer;
}

.search-bar .search-button img {
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.head-bar .byebye {
    margin-left: 20px;
    font-size: 16px;
    color: #555;
}

.head-bar .avatar {
    margin: 10px;
    width: 36px;
    height: 36px;
}

.side-bar {
    width: 180px; /* 修正选择器名，并设置合理宽度 */
    left: 0;
    top: 60px; /* 关键修改：从顶部 60px 开始，避开 header */
    bottom: 0;
    margin-right: 20px;
    flex-shrink: 0; /* 防止侧边栏被压缩 */
    background-color: rgb(255, 255, 255); /* 可选：给侧边栏加个背景色 */
    display: flex;
    flex-direction: column;
    position: fixed;
}

.side-bar .side-bar-top {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    border-bottom: 1px solid #e5e5e5; /* 可选：加个底边框 */
}

.side-bar .side-bar-top-button {
    display: flex;
    align-items: center;
    padding: 0;
    width: 100%;
    cursor: pointer;
    margin-bottom: 10px;
}

.side-bar .side-bar-top-button button {
    display: flex;
    align-items: center;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
}

.side-bar .side-bar-top-button button:hover {
    background-color: #f2f2f2;
}

.side-bar .home-icon {
    width: 24px;
    height: 24px;
    margin-left: 20px;
    margin-right: 20px;
}

.side-bar a {
    text-decoration: none;
    color: inherit;
}

.side-bar p {
    font-size: 15px;
    font-weight: 300;
}

.video-page {
    flex: 1; /* 让视频列表占据剩余空间 */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 10px;
    left: 180px; /* 给固定的 side-bar 留出空间 */
    background-color: #f9f9f9;
    /* margin-top: 60px; */ /* Moved to body padding */
}

.video-card {
    border-radius: 5px;
    padding: 10px;
    transition: box-shadow 0.3s, background-color 0.3s;
}

.video-card:hover {
    background-color: rgb(243, 241, 241);
    box-shadow: 4px 4px 10px rgba(0,0,0,0.2);
}

.thumbnail-container {
    position: relative;
    margin-bottom: 10px;
}

.video-duration {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 3px 4px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.thumbnail {
    width: 100%;
    border-radius: 10px;
    display: block;
}

.favicon {
    width: 12%;
    flex-shrink: 0; /* 防止被挤压 */
    margin-right: 10px;
}

.favicon img {
    width: 100%;
    border-radius: 50%;
}

.video-details {
    display: flex;
}

.video-info {
    width: 90%;
}

.video-title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 10px;
    width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 限制显示2行 */
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-channel, .video-stats {
    margin-bottom: 10px;
    font-size: small;
    color: rgb(79, 79, 78);
}