body {
    font-family: Arial;
    padding: 20px;
}

/* ================= BÀI 1 ================= */
.menu-chinh, .menu-con {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: blue;
    font-family: Arial, sans-serif;
}

/* --- MENU CHINH */
.menu-chinh {
    display: flex; 
    width: fit-content;
}

.menu-chinh > li {
    border-right: 1px solid white; /* Phân cách trắng */
    position: relative; 
}

.menu-chinh > li > a {
    display: block;
    padding: 15px 30px;
    color: white;
    text-decoration: none;
    font-weight: bold;
    text-align: center;
}

/* --- MENU CON */
.menu-con {
    position: absolute; 
    top: 100%;         
    left: 0;
    width: 250px;
    border-top: 1px solid white;
    z-index: 999;
}

.menu-con li {
    border-bottom: 1px solid white;
}

.menu-con li a {
    display: block;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    font-size: 14px;
}

/* HIỆU ỨNG HOVER & ACTIVE */

/* Khi di chuột vào */
.menu-chinh li a:hover, .menu-con li a:hover {
    background-color: oldlace; 
    color: blue;
}


.active {
    background-color: oldlace !important;
    color: blue !important;
}

/* ================= BÀI 2 ================= */
menu-dung, .sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: #000000; 
    width: 150px;
    border: 0.5px solid #FFF;
}

#menu-dung li {
    position: relative; 
    border-bottom: 1px solid #FFF;
}

#menu-dung li a {
    display: block;
    padding: 12px 15px;
    color: #FFF;
    text-decoration: none;
    font-weight: bold;
    font-size: 13px;
}

/* Hiệu ứng khi rê chuột qua */
#menu-dung li a:hover {
    background-color: darkgray;
}


.active-gray {
    background-color: darkgray !important;
    color: white !important;
}

/* Cấp 2 và Cấp 3 */
.sub-menu {
    position: absolute;
    top: -1px;      
    left: 100%;   
    width: max-content; 
    min-width: 150px;
    display: none;  
    z-index: 100;
}


li:hover > .sub-menu {
    display: block;
}


/* ================= BÀI 3 ================= */
body {
    margin: 0;
    font-family: Arial, sans-serif;
}

#menu-huit, .sub-menu, .sub-menu-3 {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: blue;
}

/*  MENU CẤP 1  */
#menu-huit {
    display: flex;        
    width: 100%;          
}

#menu-huit > li {
    flex: 1;             
    border-right: 1px solid white;
    position: relative;
    text-align: center;
}

#menu-huit > li:last-child {
    border-right: none;
}

#menu-huit > li > a {
    display: block;
    padding: 15px 0;      
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 13px;
    white-space: nowrap; 
}

/*  MENU CẤP 2  */
.sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 250px;       
    display: none;
    z-index: 100;
}

.sub-menu li {
    border-bottom: 1px solid white;
    text-align: left;
}

.sub-menu li a {
    display: block;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
}

/*  MENU CẤP 3  */
.sub-menu-3 {
    position: absolute;
    top: 0;
    left: 100%;
    width: 220px;
    display: none;
}

/* HIỆU ỨNG HOVER  */
li:hover > ul {
    display: block;
}

#menu-huit li a:hover, .active {
    background-color: oldlace !important;
    color: blue !important;
}