* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    overflow-x: hidden;
}

/* ==================== HEADER LAYOUT ==================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 20px 60px;
    /* Padding thoáng mặc định */
    transition: all 0.4s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
}

/* --- LOGO --- */
/* --- SỬA ĐOẠN NÀY --- */

/* 1. Canh chỉnh khối lớn: Xếp dọc (Cụm ảnh nằm trên, Chữ nằm dưới) */
.logo-group {
    display: flex;
    flex-direction: column;
    /* Quan trọng: Xếp dọc */
    align-items: center;
    /* Căn giữa */
    justify-content: center;
    gap: 5px;
    /* Khoảng cách giữa cụm ảnh và chữ */
}

/* 2. Canh chỉnh cụm ảnh: Xếp ngang (2 ảnh nằm cạnh nhau) */
.logo-images {
    display: flex;
    /* Quan trọng: Để 2 ảnh nằm ngang */
    align-items: center;
    gap: 10px;
    /* Khoảng cách giữa 2 ảnh */
}

/* 3. Chỉnh lại chữ cho nhỏ và đẹp hơn */
.logo {
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    /* Giảm size chữ (trước là 30px) */
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1;
}

/* --- KẾT THÚC ĐOẠN SỬA --- */

/* Chỉnh kích thước cho 2 logo nhỏ */
.extra-logo1 {
    height: 60px;
    width: auto;
    object-fit: contain;
}

.extra-logo2 {
    height: 55px;
    width: auto;
    object-fit: contain;
}

/* --- DESKTOP MENU --- */
.nav-menu {
    display: flex;
    gap: 30px;
    list-style: none;
}

.nav-menu a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    font-size: 18px;
    position: relative;
    transition: color 0.3s ease;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--secondary);
    transition: width 0.3s ease;
}

.nav-menu a:hover::after {
    width: 100%;
}

/* --- HAMBURGER ICON --- */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    z-index: 10000;
}

.menu-toggle span {
    width: 28px;
    height: 2px;
    background: var(--white);
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* ==================== SEARCH BOX (STYLE) ==================== */
.search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50px;
    padding: 8px 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: fit-content;
    height: 45px;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--white);
    font-size: 15px;
    width: 200px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.9);
}

.search-box button {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    font-size: 18px;
    font-weight: 500;
    padding: 5px;
}

/* Hover Effect */
.search-box:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.8);
}

/* Focus Effect (Khi gõ) */
.search-box:focus-within {
    background: #ffffff;
    border-color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.search-box:focus-within input {
    color: var(--text-dark);
    width: 240px;
}

.search-box:focus-within input::placeholder {
    color: #94a3b8;
}

.search-box:focus-within button {
    color: var(--primary);
    transform: scale(1.1);
}

/* ==================== MOBILE MENU (TRƯỢT TRÁI) ==================== */
.mobile-menu {
    position: fixed;
    top: 80px;
    left: -100%;
    /* Ẩn sang trái */
    width: 70%;
    max-width: 400px;
    height: 100vh;
    background: var(--white);
    padding: 40px 40px;
    transition: left 0.4s ease;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.1);
    z-index: 9998;
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.mobile-menu a {
    color: var(--text-dark);
    text-decoration: none;
    font-size: 20px;
    font-weight: 500;
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9997;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==================== MOBILE SEARCH BAR (FIX LỖI DÒNG TRẮNG) ==================== */
.mobile-search {
    position: fixed;
    top: 80px;
    /* Cách đỉnh trang một khoảng bằng chiều cao header */
    left: 0;
    width: 100%;
    background: #ffffff;
    padding: 15px 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    z-index: 9990;

    /* Mặc định ẩn đi */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

/* Khi có class active thì hiện ra */
.mobile-search.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mobile-search-inner {
    display: flex;
    align-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 15px;
    background: #f8fafc;
}

.mobile-search-inner input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 16px;
    color: var(--text-dark);
}

.mobile-search-inner button {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* Ẩn mobile search trên màn hình lớn */
@media (min-width: 1130px) {
    .mobile-search {
        display: none !important;
    }
}

/* ==================== SCROLLED STATE (HIỆU ỨNG CUỘN) ==================== */
.header.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 60px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Đổi màu các thành phần con khi header trắng */
.header.scrolled .logo {
    color: var(--primary);
}

.header.scrolled .nav-menu a {
    color: var(--text-dark);
}

.header.scrolled .nav-menu a::after {
    background: var(--primary);
}

.header.scrolled .menu-toggle span {
    background: var(--text-dark);
}

/* Search box khi header trắng */
.header.scrolled .search-box {
    background: #fff;
    border: 1px solid #e2e8f0;
}

.header.scrolled .search-box input {
    color: var(--text-dark);
}

.header.scrolled .search-box input::placeholder {
    color: #94a3b8;
}

.header.scrolled .search-btn {
    color: var(--primary);
}

/* ==================== RESPONSIVE HEADER ==================== */
@media (max-width: 1024px) {
    .header {
        padding: 12px 20px;
    }

    .header.scrolled {
        padding: 12px 20px;
    }
}

/* --- CSS NÚT SEARCH MOBILE (Mặc định ẩn) --- */
.mobile-search-trigger {
    display: none;
    background: transparent;
    border: none;
    color: var(--white);
    cursor: pointer;
    z-index: 10002;
    transition: color 0.3s ease;
    padding: 5px;
    /* Tăng diện tích bấm */
}

.header.scrolled .mobile-search-trigger {
    color: var(--text-dark);
}

/* --- RESPONSIVE MOBILE FIX (Quan trọng) --- */
/* ==================== RESPONSIVE MOBILE FIX ==================== */
@media (max-width: 1130px) {
    .header {
        display: grid;
        /* Chia 3 cột: Menu - Logo ở giữa - Search */
        grid-template-columns: 50px 1fr 50px;
        align-items: center;
        padding: 10px 20px;

        /* QUAN TRỌNG: Đổi height cố định thành auto để header tự giãn khi logo và chữ xếp chồng */
        height: auto;
        min-height: 70px;
    }

    /* 1. Menu Toggle -> Cột 1 (Trái) */
    .menu-toggle {
        display: flex;
        grid-column: 1;
        justify-self: start;
        margin-right: 0;
    }

    /* 2. Logo Group -> Cột 2 (Giữa) */
    .logo-group {
        grid-column: 2;
        justify-self: center;

        /* Đảm bảo vẫn giữ flex column như PC */
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        /* Khoảng cách giữa ảnh và chữ hẹp hơn trên mobile cho gọn */
    }

    /* --- CHỈNH LOGO NHỎ LẠI TRÊN MOBILE --- */
    /* Ghi đè kích thước ảnh cho mobile */
    .extra-logo1 {
        height: 40px;
        /* PC là 60px, Mobile giảm còn 40px */
    }

    .extra-logo2 {
        height: 35px;
        /* PC là 55px, Mobile giảm còn 35px */
    }

    .logo-images {
        gap: 8px;
        /* Giảm khoảng cách giữa 2 ảnh */
    }

    /* Chữ Phước Hải trên mobile */
    .logo {
        font-size: 13px;
        /* Giảm nhẹ chữ (PC 14px -> Mobile 13px) */
        white-space: nowrap;
    }

    /* 3. Search Trigger -> Cột 3 (Phải) */
    .mobile-search-trigger {
        display: block;
        grid-column: 3;
        justify-self: end;
    }

    /* 4. Ẩn Menu & Search của Desktop */
    .nav-container,
    .search-box {
        display: none !important;
    }
}

/* ==================== LIVE SEARCH DROPDOWN ==================== */
.search-box,
.mobile-search-inner {
    position: relative;
    /* Để dropdown căn theo cha */
}

.search-results {
    position: absolute;
    top: 100%;
    /* Nằm ngay dưới input */
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    margin-top: 10px;
    overflow: hidden;
    z-index: 10005;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    max-height: 400px;
    overflow-y: auto;
}

/* Hiển thị khi có dữ liệu (JS sẽ add class này) */
.search-results.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Từng dòng kết quả */
.search-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: #f8fafc;
}

/* Ảnh thumbnail trong search */
.search-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 12px;
    background: #eee;
}

.search-info h4 {
    font-size: 15px;
    color: #334155;
    margin-bottom: 3px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-info span {
    font-size: 12px;
    color: #94a3b8;
}

/* Trạng thái Loading hoặc Không tìm thấy */
.search-message {
    padding: 20px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

/* Scrollbar đẹp cho dropdown */
.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}