/* =====================================================
   GLOBAL RESET – fix đường đen mép trên (admin bar / html margin)
   ===================================================== */
html {
    margin-top: 0 !important;
    padding-top: 0 !important;
    background-color: #0b1224;
    scroll-padding-top: 0;
}
body {
    margin: 0 !important;
    padding: 0 !important;
    background-color: #0b1224;
}
html.admin-bar,
body.admin-bar {
    margin-top: 0 !important;
    padding-top: 0 !important;
}
#wpadminbar {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    visibility: hidden !important;
    border: none !important;
    box-shadow: none !important;
    pointer-events: none !important;
}

/* Cấu hình Menu Navbar mới */
.seo247-header-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    justify-content: center;
    padding: 20px 20px 0;
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    pointer-events: none;
    overflow: visible;
}

.seo247-navbar {
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1250px;
    height: 80px;
    background: rgba(17, 30, 64, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    padding: 0 40px 0 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: visible;
    position: relative;
}

.seo247-logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
}

.seo247-logo-img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.seo247-logo-text {
    color: #ffffff;
    font-size: 24px;
    font-weight: 800;
    text-shadow: 0 0 15px rgba(56, 189, 248, 0.6); /* Hiệu ứng sáng nhẹ Neon */
    letter-spacing: 0.02em;
}

/* Container Menu */
.seo247-nav-menu {
    display: flex;
    align-items: center;
    gap: 40px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Các thẻ li trong menu cấp 1 */
.seo247-nav-menu > .menu-item {
    position: relative;
    padding: 0;
}

/* Thẻ a mặc định */
.seo247-nav-menu .seo247-nav-item,
.seo247-nav-menu .menu-item a {
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.9;
}

/* Hover thẻ a */
.seo247-nav-menu .menu-item:hover > a {
    color: #38bdf8;
    opacity: 1;
}

/* Giữ parent item active khi hover vào dropdown */
.seo247-nav-menu > .has-dropdown:has(.dropdown-menu:hover) > a {
    color: #38bdf8;
    opacity: 1;
}

/* Dropdown Cấp 1 (Sổ xuống) */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: rgba(22, 33, 62, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    min-width: 240px;
    padding: 12px 0;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    list-style: none;
    margin: 0;
    
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    white-space: nowrap;
}

/* Tạo bridge để lấp gap giữa menu và dropdown */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 0;
    right: 0;
    height: 15px;
    background: transparent;
}

/* Hiển thị Dropdown Cấp 1 khi hover menu cấp 1 */
.seo247-nav-menu > .has-dropdown:hover > .dropdown-menu,
.seo247-nav-menu > .has-dropdown:focus-within > .dropdown-menu,
.dropdown-menu:hover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

/* Đảm bảo bridge nhận pointer events khi dropdown hiển thị */
.seo247-nav-menu > .has-dropdown:hover > .dropdown-menu::before,
.dropdown-menu:hover::before {
    pointer-events: auto;
}

/* Giữ dropdown cấp 1 hiển thị khi di chuột vào sub-dropdown */
.dropdown-menu:hover ~ *,
.has-dropdown:has(> .dropdown-menu:hover) > .dropdown-menu,
.dropdown-menu li:hover ~ .dropdown-menu,
.dropdown-menu:has(li:hover) {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

/* Các item trong Dropdown Cấp 1 & 2 */
.dropdown-menu li,
.sub-dropdown-menu li {
    position: relative;
    padding: 0;
    list-style: none;
}

.dropdown-menu li > a,
.sub-dropdown-menu li > a {
    padding: 12px 20px;
    font-size: 14px;
    text-transform: none; /* Bỏ in hoa cho menu con */
    letter-spacing: normal;
    font-weight: 500;
    justify-content: flex-start;
    opacity: 0.85;
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    white-space: nowrap;
    width: 100%;
}

.dropdown-menu li:hover > a,
.sub-dropdown-menu li:hover > a {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
    opacity: 1;
}

/* Dropdown Cấp 2 (Mở ngang) */
.sub-dropdown-menu {
    position: absolute;
    top: 0;
    left: 100%;
    margin-left: 5px;
    background: rgba(22, 33, 62, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    min-width: 240px;
    padding: 12px 0;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    list-style: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    
    /* Animation Fade in Slide right */
    opacity: 0;
    visibility: hidden;
    transform: translateX(15px);
    transition: all 0.3s ease;
    z-index: 10001;
}

/* Tạo bridge để lấp gap giữa dropdown và sub-dropdown */
.sub-dropdown-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: -10px;
    bottom: 0;
    width: 10px;
    background: transparent;
}

/* Hiển thị Dropdown Cấp 2 khi hover item cấp 1 trong dropdown */
.dropdown-menu .has-sub-dropdown:hover > .sub-dropdown-menu,
.dropdown-menu .has-sub-dropdown:focus-within > .sub-dropdown-menu,
.sub-dropdown-menu:hover,
.dropdown-menu li:hover > .sub-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

/* Đảm bảo bridge nhận pointer events khi sub-dropdown hiển thị */
.dropdown-menu .has-sub-dropdown:hover > .sub-dropdown-menu::before,
.sub-dropdown-menu:hover::before {
    pointer-events: auto;
}

/* Icon mũi tên */
.seo247-dropdown-icon { font-size: 10px; margin-top: 2px; }
.seo247-sub-icon { font-size: 14px; margin-top: 1px; opacity: 0.6; }

/* Nút Toggle Mobile mặc định ẩn trên PC */
.seo247-mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 24px;
    position: relative;
    z-index: 10000;
}

.seo247-mobile-toggle .bar {
    display: block;
    width: 100%;
    height: 3px;
    background: #ffffff;
    border-radius: 3px;
    position: absolute;
    transition: all 0.3s ease;
}

.seo247-mobile-toggle .bar:nth-child(1) { top: 0; }
.seo247-mobile-toggle .bar:nth-child(2) { top: 10px; }
.seo247-mobile-toggle .bar:nth-child(3) { top: 20px; }

/* Trạng thái Active của Hamburger */
.seo247-mobile-toggle.active .bar:nth-child(1) { top: 10px; transform: rotate(45deg); }
.seo247-mobile-toggle.active .bar:nth-child(2) { opacity: 0; }
.seo247-mobile-toggle.active .bar:nth-child(3) { top: 10px; transform: rotate(-45deg); }

@media (max-width: 1024px) {
    .seo247-nav-menu {
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .seo247-navbar {
        padding: 0 20px;
    }
    
    .seo247-logo-text { font-size: 18px; }
    .seo247-logo-img { height: 35px; }
    
    /* Hiển thị Hamburger */
    .seo247-mobile-toggle {
        display: block;
    }
    
    /* Chuyển Menu thành Offcanvas (Sidebar di động) */
    .seo247-nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: rgba(17, 30, 64, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: flex-start;
        padding: 100px 20px 30px;
        transition: right 0.4s ease;
        overflow-y: auto;
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
        gap: 10px;
    }
    
    .seo247-nav-menu.active {
        right: 0;
    }
    
    .seo247-nav-menu > .menu-item {
        width: 100%;
        padding: 15px 0;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    .seo247-nav-menu .seo247-nav-item {
        font-size: 14px;
    }
    
    /* Dropdown trên mobile sẽ xổ dọc thay vì Hover */
    .dropdown-menu, .sub-dropdown-menu {
        position: static;
        width: 100%;
        background: transparent;
        box-shadow: none;
        border: none;
        padding: 0 0 0 15px;
        margin: 0;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        max-height: 0;
        overflow: hidden;
        transform: none;
        transition: all 0.3s ease;
    }
    
    /* JS sẽ gán class active vào li.has-dropdown để mở */
    .has-dropdown.mobile-open > .dropdown-menu,
    .has-sub-dropdown.mobile-open > .sub-dropdown-menu {
        display: block;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        max-height: 500px;
        margin-top: 10px;
        margin-bottom: 10px;
    }
    
    .dropdown-menu li,
    .sub-dropdown-menu li {
        padding: 8px 0;
    }
    
    .dropdown-menu li > a,
    .sub-dropdown-menu li > a {
        font-size: 13px;
        padding: 10px 0;
    }
}
