
body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #1a1a1a;
    color: white;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

header {
    display: flex;
    align-items: center; 
    justify-content: space-between;
    width: 100%;
    height: 600px; 
    background-image: url('../images/homebg.jpg'); 
    background-size: cover; 
    background-position: center;
    background-repeat: no-repeat; 
    background-color: #0a0a0a;
    padding: 0;
    position: relative; 
    margin-bottom: 0px;
}


.header-logo {
    position: absolute; /* 绝对定位 */
    top: 117px; /* 调整top值，使Logo与搜索栏垂直高度大致相同 */
    left: 15px; /* 左侧间隔，根据需要调整 */
    height: 80px; /* Logo大小，根据需要调整 */
    width: auto; /* 保持图像的宽高比 */
}

nav ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: space-between;
}

nav {
    position: absolute;
    width: 100%;
    top: 45px;
    left: 0;
    right: 0;  
}

nav ul li a {
    text-decoration: none;
    color: #F0E4BF;
    padding: 10px 20px;
    font-weight: bold;
    font-size: 22px; /* Larger font size for better readability */
    font-family: Arial, Helvetica, sans-serif; /* Fallbacks included */
}

nav ul li a.active {
    color: #FCE293;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: #DEEEEB;
    border-radius: 25px;
    padding: 10px;
    width: 25%; /* Adjusted to 4/5ths of the original 40% */
    position: absolute;
    right: 20px;
    top: 90px; /* Adjusted to match the top spacing of the navigation text */
}

.search-bar input[type="text"] {
    flex-grow: 1;
    border: none;
    padding: 8px 10px;
    outline: none;
    background: transparent;
}

.search-bar button {
    background: transparent;
    color: white;
    padding: 8px 12px;
    border: none;
    cursor: pointer;
}

/* Main Section Styles */
main {
    padding: 20px;
    position: relative;
    background-size: cover;
    margin-top: 0;
    justify-content: center; /* Centers content vertically */
    height: 100vh; /* Use the full height of the viewport */
}

.title-bar {
    margin-top: 5px;
    display: flex;
    align-items: center;
    justify-content: space-around; /* This will space out the lines and text */
    position: relative;
    margin-bottom: 5px;
}

.title-bar .line {
    flex: 1;
    border: none;
    height: 1.5px;
    margin-top: 5%;
    background-color: #F0E4BF;
    margin: 0 10px; /* Space between the text and lines */
}

.top-movies h1 {
    margin-top: 10px;
    padding: 0 10px;
    color: #D3CAA8;
    font-size: 24px;
    font-family: 'Comic Sans MS', Tahoma, sans-serif;
    background: transparent;
    z-index: 1;
}

.movie-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 20px;
}

.movie {
    background-color: #404040;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

.movie img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
}

.movie .movie-title {
    font-size: 30px; /* 设置字体大小为 22px */
    font-family: Arial, sans-serif;
    font-weight: bold;
}

.movie p:last-child {
    font-size: 30px;
    text-align: center; 
    
}

.movie:hover {
    background-color: #d2d0d0;
    color: rgb(20, 17, 17);
}

/* Footer Styles */
footer {
    background-color: #333;
    text-align: center;
    padding: 10px 0;
    width: 100%;
    color: white;
}

/* Responsive Design */


@media (max-width: 768px) {
    body {
        overflow-x: hidden; /* Prevent horizontal scrolling */
    }

    header {
        flex-direction: column;
        align-items: center;
        height: 180px; /* Automatic height for small screens */
    }

    .header-logo {
        margin: 10px 0;
        height: 60px;  /* Smaller logo for small screens */
        max-height: 100%; /* Ensure logo does not exceed header height */
    }

    nav {
        position: static;
        width: 100%;
    }

    nav ul {
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
    }

    nav ul li {
        flex: 1;
    }

    nav ul li a {
        width: 100%;
        text-align: center;
        padding: 10px;
        font-size: 15px;

    .search-bar {
        width: 30%; /* Adjusted width for small screens */
        margin-top: 10px;
        position: static;
    }

    .movie-list {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Adjust grid columns for small screens */
    }
}

@media (max-width: 480px) {
    body {
        overflow-x: hidden; /* Prevent horizontal scrolling */
    }

    header {
        height: 180px;
        width: 100%;
    }
}

    .header-logo {
        height: 50px; /* Smaller logo for extra small screens */
        height: 50px;
        top: 50px;
    }

    .search-bar {
        width: 35%; /* Full width for extra small screens */
        display: flex;
        align-items: center;
        top: 40px;
    }

    .search-bar button {
        padding: 8px 5px; /* Adjust padding for search button */
        position: absolute;
        right: 5px;
    }

    nav ul {    
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        width: 100%;
    }
    
    nav ul li a {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        padding: 5px 0;
        font-size: 12px;
    }

    .top-movies h1 {
        font-size: 18px; /* Adjusted font size for extra small screens */
    }

    .movie .movie-title, .movie p:last-child {
        font-size: 18px; /* Adjusted font size for extra small screens */
    }

    .movie-list {
        grid-template-columns: 1fr 1fr;
    }
}
