/*
Theme Name: VP Movie
Theme URI: https://example.com
Author: Shinzyx
Description: Theme xem phim tối giản, siêu tốc độ, tương thích tuyệt đối với hệ thống Crawler API.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: vpmovie
*/

/* === 1. RESET CHỐNG LỆCH & TRÀN MÀN HÌNH MOBILE === */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* Khóa tràn ngang gây hụt nền đen bên phải */
    background-color: #0f0f0f;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* === 2. KHUNG HEADER CHUNG === */
.site-header {
    width: 100%;
    background-color: #141414;
    color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* === 3. TẦNG 1: LOGO & Ô TÌM KIẾM === */
.header-top {
    width: 100%;
    border-bottom: 1px solid #262626;
    padding: 12px 0;
}

.header-top-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
    width: 100%;
}

.logo a {
    color: #e50914;
    font-size: 26px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.logo img {
    max-height: 40px;
    width: auto;
    display: block;
}

/* Ô tìm kiếm */
.header-search {
    flex: 1;
    max-width: 450px;
    min-width: 0; /* Chống tràn flex item trên mobile */
}

.search-form {
    display: flex;
    align-items: center;
    width: 100%;
    background: #222;
    border-radius: 25px;
    padding: 4px 14px;
    border: 1px solid #3a3a3a;
    transition: border-color 0.3s;
}

.search-form:focus-within {
    border-color: #e50914;
}

.search-field {
    flex: 1;
    width: 100%;
    min-width: 0;
    background: transparent;
    border: none;
    color: #fff;
    padding: 6px 4px;
    font-size: 14px;
    outline: none;
}

.search-field::placeholder {
    color: #999;
}

.search-submit {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    flex-shrink: 0;
}

/* Nút mở menu trên Mobile (Ẩn trên Desktop) */
.menu-toggle {
    display: none;
    background: #222;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #fff;
    font-size: 20px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* === 4. TẦNG 2: THANH MENU BÊN DƯỚI === */
.header-bottom {
    width: 100%;
    background-color: #1a1a1a;
}

.main-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.main-menu li {
    position: relative;
}

.main-menu a {
    color: #e5e5e5;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    padding: 12px 0;
    display: block;
    transition: color 0.2s;
}

.main-menu a:hover,
.main-menu .current-menu-item > a {
    color: #e50914;
}

/* Sub-menu (Menu con trên Desktop) */
.main-menu .sub-menu {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: #222;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 100;
}

.main-menu li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.main-menu .sub-menu li a {
    padding: 8px 16px;
    font-size: 14px;
}

.main-menu .sub-menu li a:hover {
    background: #2e2e2e;
}

/* === 5. TỐI ƯU GIAO DIỆN MOBILE (< 992px) === */
@media (max-width: 991px) {
    .header-top-inner {
        gap: 10px;
    }

    .logo {
        order: 1;
    }

    .menu-toggle {
        display: flex;
        order: 2;
    }

    /* Đưa ô tìm kiếm xuống hàng 2, vừa khít chiều ngang màn hình */
    .header-search {
        order: 3;
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
        margin: 4px 0 0 0;
    }

    .main-navigation {
        display: none;
        padding: 8px 0;
    }

    .main-navigation.is-open {
        display: block;
    }

    .main-menu {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }

    .main-menu li {
        width: 100%;
        border-bottom: 1px solid #2b2b2b;
    }

    .main-menu li:last-child {
        border-bottom: none;
    }

    .main-menu a {
        padding: 12px 0;
    }

    .main-menu .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: #141414;
        padding: 0 0 8px 15px;
        display: none;
    }

    .main-menu li.submenu-open > .sub-menu {
        display: block;
    }

    .submenu-toggle {
        position: absolute;
        right: 0;
        top: 6px;
        background: #2b2b2b;
        color: #fff;
        border: none;
        width: 32px;
        height: 32px;
        border-radius: 4px;
        cursor: pointer;
        font-size: 12px;
    }
}