/* --- CHỈ ÁP DỤNG CHO DESKTOP (LỚN HƠN 849px) --- */
@media screen and (min-width: 850px) {
    /* Ẩn header mặc định của Flatsome trên Desktop khi bật Vertical Header */
    body.has-vertical-header header#header, 
    body.has-vertical-header .header-wrapper {
        display: none !important;
    }
}

:root {
    --cvh-red: #8f0808; /* Màu đỏ của theme */
    --cvh-dark: #1f1f1f; /* Màu xám đen của panel */
    --cvh-text: #ffffff;
    --cvh-width: 260px; /* Giảm độ rộng từ 320px xuống 260px */
    --cvh-trigger-width: 50px;
}

/* Đẩy nội dung trang sang phải một khoảng bằng thanh đỏ để layout luôn được cân đối ở chính giữa không gian còn lại */
@media screen and (min-width: 850px) {
    body.has-vertical-header #wrapper {
        padding-left: var(--cvh-trigger-width) !important;
    }
}

/* Vùng header tùy chỉnh */
.custom-vertical-header {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 99999;
    display: flex;
}

/* Xử lý khi có thanh Admin Bar của WordPress (để tránh bị thanh đen che mất logo) */
.admin-bar .custom-vertical-header {
    top: 32px;
    height: calc(100vh - 32px);
}

/* --- CHỈ ÁP DỤNG CHO MOBILE (NHỎ HƠN 850px) --- */
@media screen and (max-width: 849px) {
    /* Ẩn cái Menu dọc tự chế đi, để xài lại Menu Mobile của Flatsome */
    .custom-vertical-header {
        display: none !important;
    }
}

/* Thanh đỏ chứa nút hamburger */
.cvh-trigger-bar {
    width: var(--cvh-trigger-width);
    height: 100vh;
    background-color: var(--cvh-red);
    display: flex;
    justify-content: center;
    padding-top: 30px;
    position: relative;
    z-index: 10;
    cursor: pointer;
}

.cvh-hamburger {
    width: 24px;
    height: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cvh-hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: var(--cvh-text);
    transition: all 0.3s ease;
}

/* Panel Menu Xám đen */
.cvh-panel {
    position: absolute;
    top: 0;
    left: var(--cvh-trigger-width);
    width: var(--cvh-width);
    height: 100vh;
    background-color: var(--cvh-dark);
    padding: 40px 30px;
    /* Ẩn đi bằng cách đẩy sang trái và giảm opacity */
    transform: translateX(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease, visibility 0.4s ease;
    z-index: 5;
    overflow: visible; /* Bỏ auto để không cắt (clip) menu cấp 2 khi bay ra ngoài */
    box-shadow: 10px 0 20px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}

/* Hiệu ứng Hover vào thanh đỏ hoặc hover trực tiếp vào panel menu, HOẶC khi click .is-active */
.cvh-trigger-bar:hover ~ .cvh-panel,
.cvh-panel:hover,
.custom-vertical-header.is-active .cvh-panel {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

/* Logo cố định đè lên trang */
.cvh-fixed-logo {
    position: absolute;
    top: 18px; /* Đã kéo lên cao hơn để ngang hàng với nút menu */
    left: calc(var(--cvh-trigger-width) + 25px); /* Khoảng cách với thanh đỏ */
    z-index: 1; /* Nằm dưới panel xám đen để khi trượt ra panel sẽ đè lên logo này */
    pointer-events: auto; /* Cho phép click vào logo này */
}
.cvh-fixed-logo a {
    text-decoration: none;
    display: inline-block;
}
.cvh-fixed-logo img {
    max-width: 160px;
    height: auto;
}

/* Logo trong Panel */
.cvh-logo {
    margin-bottom: 50px;
}
.cvh-logo a {
    text-decoration: none;
    display: inline-block;
}
.cvh-logo img {
    max-width: 160px;
    height: auto;
}
/* Style cho text logo nếu chưa có ảnh */
.logo-text {
    color: var(--cvh-text);
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    display: flex;
}
.logo-text .red-t {
    position: relative;
}
.logo-text .red-t::before {
    content: '';
    position: absolute;
    top: 0;
    left: -2px;
    width: 10px;
    height: 10px;
    background-color: var(--cvh-red);
    z-index: -1;
}

/* Menu Style */
.cvh-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    /* Loại bỏ position relative ở ul nếu có */
}
.cvh-menu li {
    margin-bottom: 20px;
    /* Không để position: relative ở đây để submenu có thể căn theo cvh-panel */
}
.cvh-menu li a {
    color: #e0e0e0;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    display: block;
    transition: all 0.3s ease;
    font-family: "Inter", sans-serif;
}

/* Hover Menu Item */
.cvh-menu li a:hover,
.cvh-menu li.current-menu-item > a {
    color: #ff3333;
}

/* Sub-menu (Menu cấp 2 bay sang phải) */
.cvh-menu li .sub-menu {
    position: absolute;
    top: 0;
    left: 100%; /* Nằm sát mép phải của panel chính */
    width: 300px;
    min-height: 100%; /* Kéo dài từ trên xuống dưới */
    background-color: rgba(0, 0, 0, 0.75); /* Nền đen trong suốt */
    padding: 120px 40px 40px 40px; /* Thụt xuống để vừa tầm mắt */
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    list-style: none;
    margin: 0;
    z-index: -1; /* Nằm dưới text của menu chính (nếu có tràn) */
}

/* Hiển thị sub-menu khi hover vào li cha */
.cvh-menu li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.cvh-menu li .sub-menu li {
    margin-bottom: 25px;
}

.cvh-menu li .sub-menu li a {
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
}
.cvh-menu li .sub-menu li a:hover {
    color: #ff3333;
}

/* Dấu + cho menu có cấp con */
.cvh-menu li.menu-item-has-children > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cvh-menu li.menu-item-has-children > a::after {
    content: '+';
    font-size: 18px;
    font-weight: 400;
    color: #e0e0e0;
    transition: all 0.3s ease;
}
.cvh-menu li.menu-item-has-children:hover > a::after,
.cvh-menu li.menu-item-has-children.current-menu-item > a::after {
    content: '—'; /* Đổi thành dấu trừ gạch ngang khi hover */
    color: #ff3333; /* Đổi màu đỏ */
}

@media only screen and (max-width: 48em) {
/*************** ADD MOBILE ONLY CSS HERE  ***************/
    .cvh-panel {
        width: calc(100vw - var(--cvh-trigger-width));
    }
}

/* --- GTRANSLATE WIDGET CUSTOM POSITION --- */
/* Move from fixed bottom-right to absolute top-right */
#gtranslate_wrapper, .gtranslate_wrapper,
#gt_float_wrapper, .gt_float_wrapper,
.gt_switcher_wrapper, .gt_switcher, .gtranslate, #gtranslate {
    position: absolute !important;
    top: 5px !important;
    right: 20px !important;
    bottom: auto !important;
    left: auto !important;
    z-index: 999999 !important;
}

/* Force flag and text to be on the same line */
.gt_switcher_wrapper .gt_selected,
.gt_switcher_wrapper a,
.gtranslate_wrapper .gt_selected,
.gtranslate_wrapper a,
.gt_float_switcher .gt_selected,
.gt_float_switcher a {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-direction: row !important;
    white-space: nowrap !important;
    gap: 8px !important;
}

.gt_switcher_wrapper img,
.gtranslate_wrapper img,
.gt_float_switcher img {
    margin: 0 !important;
    display: block !important;
    width: 24px !important; /* Make flag slightly bigger */
    height: auto !important;
}

/* Make text larger and white for the main toggle */
.gt_switcher_wrapper .gt_selected a,
.gt_switcher_wrapper .gt_selected span,
.gtranslate_wrapper .gt_selected a,
.gtranslate_wrapper .gt_selected span,
.gt_float_switcher .gt_selected a,
.gt_float_switcher .gt_selected span {
    color: #ffffff !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
}

/* Ensure dropdown options have dark text */
.gt_switcher_wrapper .gt_option a,
.gt_switcher_wrapper .gt_option span,
.gtranslate_wrapper .gt_option a,
.gtranslate_wrapper .gt_option span,
.gt_float_switcher .gt_option a,
.gt_float_switcher .gt_option span,
.gt_white_content a,
.gt_white_content span {
    color: #333333 !important;
    font-size: 15px !important;
    text-decoration: none !important;
}
