/* Layout tổng thể Header */
.site-header {
    width: 100%;
    background-color: #ffffff;
    padding-top: 45px; /* Chiều cao tương đương thanh navigation cố định */
}

/* Phần trên của Header */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #ffffff;
    border-bottom: 1px solid #eeeeee;
    gap: 15px;
}

.logo h3 {
    margin: 0;
    color: #0056b3;
    font-weight: bold;
    white-space: nowrap;
}

.search-bar {
    flex: 0 1 500px;
}

.search-bar input {
    width: 100%;
    padding: 8px 15px;
    border-radius: 4px;
    border: 1px solid #cccccc;
    box-sizing: border-box;
}

.user-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    white-space: nowrap;
}

.user-profile a.user-name {
    color: #333333;
    text-decoration: none;
    font-weight: bold;
}

.user-profile a.logout-link {
    margin-left: 6px;
    color: #dc2626;
    text-decoration: none;
    font-size: 13px;
}

.user-profile a.login-link, 
.user-profile a.register-link {
    color: #0056b3;
    text-decoration: none;
    font-size: 14px;
}

.user-profile .divider {
    color: #cccccc;
    margin: 0 4px;
}

/* ==========================================
   Thanh Navigation Cố Định (Desktop & Mobile)
   ========================================== */
.main-navigation {
    background-color: #0056b3;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 45px;
}

/* Ẩn nút Toggle trên màn hình máy tính */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
}

/* Menu Desktop */
.main-navigation ul.nav-menu {
    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.main-navigation ul.nav-menu li a {
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.main-navigation ul.nav-menu li a:hover {
    opacity: 0.85;
}

/* ==========================================
   RESPONSIVE DESIGN (Màn hình nhỏ < 768px)
   ========================================== */
@media (max-width: 768px) {
    .site-header {
        padding-top: 45px;
    }

    /* Bật nút Toggle trên Mobile */
    .menu-toggle {
        display: flex;
    }

    /* Header top sắp xếp lại trên mobile */
    .header-top {
        flex-wrap: wrap;
        padding: 10px 15px;
    }

    .search-bar {
        order: 3;
        flex: 1 1 100%;
        margin-top: 8px;
    }

    /* Chuyển menu danh sách thành dạng Dropdown xổ xuống */
    .main-navigation ul.nav-menu {
        display: none; /* Ẩn mặc định */
        flex-direction: column;
        position: absolute;
        top: 45px;
        left: 0;
        width: 100%;
        background-color: #004494;
        box-shadow: 0 4px 10px rgba(0,0,0,0.2);
        padding: 10px 0;
        gap: 0;
    }

    /* Hiển thị menu khi JS thêm class active */
    .main-navigation ul.nav-menu.active {
        display: flex;
    }

    .main-navigation ul.nav-menu li {
        width: 100%;
    }

    .main-navigation ul.nav-menu li a {
        display: block;
        padding: 12px 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 15px;
    }

    .main-navigation ul.nav-menu li a:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
}