/*
Theme Name: Movie Theme
Author: Your Name
Description: A simple WordPress theme for a movie website.
Version: 1.0
*/

:root {
    --primary-color: #0D6EFD;
    --secondary-color: #dc3545;
    --background-color: #000000;
    --text-color: #ffffff;
    --link-color: #FFA500;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
}

/* Header Styles */
.header {
    padding: 1rem 0;
    background-color: var(--background-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
}

.logo {
    width: 120px;
    display: block;
}

/* Navigation Styles */
.nav-menu {
    background-color: var(--background-color);
    padding: 1rem 0;
    text-align: center;
    display: flex;
    justify-content: center;
}

.nav-menu ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 0;
}

.nav-menu a {
    text-decoration: none;
    color: var(--link-color);
    font-weight: bold;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

/* Time Period Navigation */
.homepage-header{
      display: flex;
     justify-content: space-between;
    align-items: center;
        max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
}
.time-periods {
    text-align: center;
    padding: 0;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    white-space: nowrap;
     justify-content: center;
}

.time-periods a {
    color: var(--primary-color);
    text-decoration: none;
    margin: 0 0.5rem;
    font-size: 0.9rem;
}
.movie-genres{
      display: flex;
    align-items: center;
    white-space: nowrap;
}
.movie-genres a {
    color: var(--primary-color);
    text-decoration: none;
    margin: 0 0.5rem;
    font-size: 0.9rem;
}
.homepage-layout {
    display: flex;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Movie Grid */
.movie-grid {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    flex: 1; /* Thay đổi từ flex: 0 0 70% */
    margin-right: 20px;
}
.movie-grid-inner {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}
.movie-grid-title{
    text-align: left;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #ffffff;
    margin-top: 0;
    line-height: 1.2;
    width: 100%;
}
.movie-card img {
    width: 204px;
    height: 300px;
    display: block;
    margin: 0 auto;
    object-fit: cover;
}
.movie-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: opacity 0.5s, transform 0.5s;
    flex: 0 0 calc(25% - 2rem);
    margin-right: 2rem;
    margin-bottom: 2rem;
    opacity: 0; /* JS sẽ set opacity 1 */
    transform: translateY(20px); /* JS sẽ set translateY(0) */
}
.movie-card:nth-child(4n){
  margin-right: 0;
}
.movie-card:hover {
    transform: translateY(-5px);
}

.movie-info {
    padding: 1rem;
    background-color: var(--background-color);
    text-align: center;
    position: relative;
}

.movie-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--link-color);
}
.movie-categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 0.5rem;
}
.movie-country-item, .movie-genre-item {
    color: #ffffff;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
     margin-right: 5px;
}
.movie-country-item{
    background-color: #ff0000;
}
.movie-genre-item{
    background-color: #008000;
    margin-left: 5px;
}
.movie-country-item a, .movie-genre-item a{
    color: #ffffff;
    text-decoration: none;
}
.category-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--secondary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}
/* Search Bar */
.search-bar {
    display: flex;
    justify-content: center;
    padding: 1rem;
    align-items: center;
}

.search-input {
    padding: 0.5rem 1rem;
    width: 300px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-right: 0.5rem;
}

.search-button {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Sidebar Styles */
#secondary.widget-area { /* Thêm ID để tăng độ ưu tiên */
    width: 300px;
    flex-shrink: 0; /* Ngăn sidebar bị co lại */
}
.sidebar-updated-posts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.sidebar-updated-posts-title{
     text-align: left;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #ffffff;
}
.sidebar-movie-card {
     display: flex;
    align-items: center;
    border-bottom: 1px solid #ddd;
    padding-bottom: 1rem;
}
.sidebar-movie-card:last-child{
    border-bottom: none;
    padding-bottom: 0;
}
.sidebar-movie-card img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    margin-right: 1rem;
}
.sidebar-movie-info{
        flex: 1;
        text-align: left;
}
.sidebar-movie-title{
     font-size: 1rem;
     margin-bottom: 0.3rem;
     font-weight: bold;
}
.sidebar-movie-categories {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 0.3rem;
}
.sidebar-movie-country-item, .sidebar-movie-genre-item {
    color: #ffffff;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
       margin-right: 5px;
}
.sidebar-movie-country-item{
    background-color: #ff0000;
}
.sidebar-movie-genre-item{
    background-color: #008000;
    margin-left: 5px;
}
.sidebar-movie-country-item a, .sidebar-movie-genre-item a {
    color: #ffffff;
    text-decoration: none;
}
/* Base link styles */
a {
    color: inherit;
    text-decoration: none;
}

/* Menu cha/con */
.nav-menu ul li ul {
    display: none;
    position: absolute;
    background-color: #333;
    padding: 0;
    margin: 0;
    list-style: none;
    z-index: 1000;
}
.nav-menu ul li:hover > ul,
.nav-menu ul li.menu-item-has-children.open > ul {
    display: block;
}
.nav-menu ul li ul li {
    padding: 0.5rem 1rem;
}
.nav-menu ul li ul li a {
     color: white;
    text-decoration: none;
    font-weight: normal;
    display: block;
}
.nav-menu ul li.menu-item-has-children > a:after {
  content: "+";
  float: right;
   margin-left: 5px;
}

/* Custom CSS for Highlight word */
.entry-content .highlight-word,
.entry-content a .highlight-word {
    background-color: green;
    color: orange;
    font-weight: bold;
    text-transform: uppercase;
    padding: 0.2em 0.4em;
    line-height: 1;
}

/* ==========================================================================
   CSS Tùy chỉnh cho trang chi tiết bài viết (Single Post) - THÊM VÀO ĐÂY
   ========================================================================== */

/* Căn giữa toàn bộ nội dung trong trang single.php */
.single .site-main {
    width: 100%;
    max-width: 800px; /* Chiều rộng tối đa của nội dung */
    margin: 0 auto;   /* Tự động căn giữa */
    padding: 20px;
}

/* Căn giữa tiêu đề bài viết */
.single .entry-header,
.single .entry-title {
    text-align: center;
}

/* Căn giữa ảnh đại diện (thumbnail) */
.single .post-thumbnail {
    text-align: center;
    margin-bottom: 20px;
}

.single .post-thumbnail img {
    display: inline-block;
    max-width: 100%;
    height: auto;
}

/* Căn trái lại nội dung mô tả phim thay vì căn giữa */
.single .entry-content {
    text-align: left;
}

/* Riêng nút XEM PHIM vẫn căn giữa */
.single .entry-content h1 {
    text-align: center;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
    .nav-menu ul {
        flex-direction: column;
        gap: 1rem;
    }
    
    .homepage-layout {
        flex-direction: column;
        padding: 1rem;
    }
    
    .movie-grid {
        flex-direction: column;
        margin-right: 0;
    }
     .movie-grid-inner{
         flex-direction: column;
         align-items: center; /* Căn giữa các movie card trên mobile */
     }
    .movie-card {
        flex: 0 0 90%; /* Chiếm gần hết chiều rộng trên mobile */
        margin-right: 0;
        margin-bottom: 2rem;
    }
    .movie-card:nth-child(even), .movie-card:nth-child(odd) {
        margin-right: 0;
    }

    #secondary.widget-area{
        width: 100%;
        padding-left: 0;
        margin-top: 2rem; /* Thêm khoảng cách với lưới phim */
    }
    
    .time-periods {
        justify-content: flex-start;
        overflow-x: auto;
    }
    .movie-genres{
         justify-content: flex-start;
          overflow-x: auto;
         margin-top: 10px;
    }
    
    .entry-content a .highlight-word,
    .entry-content .highlight-word {
        display: inline-block; 
    }
}