/* HEADER MODULE CSS */
.top-bar {
    background: transparent;
    padding: 6px 0;
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    border-bottom: 1px solid rgba(255,255,255,0.12);
    transition: max-height 0.35s ease, opacity 0.35s ease, padding 0.35s ease, background 0.4s ease, color 0.4s ease, border-color 0.4s ease;
    max-height: 60px;
    overflow: hidden;
    opacity: 1;
}
/* Ẩn top-bar khi cuộn xuống */
.site-header.scrolled .top-bar {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-color: transparent;
}
.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.top-bar-left { display: flex; gap: 20px; align-items: center; }
.social-icons { display: flex; gap: 8px; align-items: center; }
.social-icons a {
    display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center;
    border-radius: 50%; color: #fff; text-decoration: none; font-size: 14px;
}
.social-icons .fb { background: #1877F2; }
.social-icons .yt { background: #FF0000; }
.social-icons .zl { background: #0084FF; line-height: 1; }

.site-header {
    background: transparent;
    border-bottom: 1px solid transparent;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

/* Khi cuộn xuống: header đổi sang nền trắng glassmorphism */
.site-header.scrolled {
    background: rgba(255,255,255,0.92);
    border-bottom: 1px solid var(--clr-border);
    box-shadow: 0 2px 24px rgba(0,0,0,0.10);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Compensate khoảng header fixed cho nội dung bên dưới */
.site-main {
    padding-top: 0 !important;
}
.header-main {
    display: flex; justify-content: space-between; align-items: center; height: 105px;
}
.logo { 
    height: 100%; 
    display: flex; 
    align-items: center; 
    position: relative; 
    width: 250px; 
}
.logo a { 
    position: absolute; 
    top: 50%;
    transform: translateY(-50%); 
    left: 0; 
    display: flex; 
    align-items: center; 
    z-index: 1050; 
}
@keyframes logoPulseGlow {
    0% { filter: drop-shadow(0 0 8px rgba(0, 104, 255, 0.6)); transform: scale(1); }
    50% { filter: drop-shadow(0 0 25px rgba(0, 104, 255, 1)); transform: scale(1.04); }
    100% { filter: drop-shadow(0 0 8px rgba(0, 104, 255, 0.6)); transform: scale(1); }
}
.logo img { 
    height: 179px !important;
    width: auto !important;
    max-width: 350px !important;
    max-height: none !important;
    object-fit: contain !important;
    display: block;
    transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 1;
}
/* Khi scroll: bỏ viền sáng (drop-shadow) của logo và làm trong suốt nền trắng */
.site-header.scrolled .logo img {
    filter: none;
    mix-blend-mode: multiply;
}
.logo a:hover img {
    filter: drop-shadow(0 0 30px rgba(0, 104, 255, 1)) brightness(1.2);
    transform: scale(1.08);
}
.main-nav { display: flex; align-items: center; }
.main-nav ul { display: flex; gap: 25px; }
.main-nav a {
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    padding: 20px 0;
    display: block;
    color: rgba(255,255,255,0.92);
    transition: color 0.3s ease;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    position: relative;
}
/* Icon trong nav kế thừa màu trắng khi header transparent */
.main-nav a i {
    color: inherit !important;
    transition: color 0.3s ease;
}

/* Gradient gạch chân cho menu */
.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(270deg, #b31d2f 0.68%, #7550a8 36.18%, #685ab4 51.41%, #2e75d8 66%, #94b0e8 83.6%, #50bbca 98.86%);
    transform: scaleX(0);
    transform-origin: right center;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.main-nav a:hover::after,
.main-nav li.current-menu-item a::after {
    transform: scaleX(1);
    transform-origin: left center;
}

/* Gradient text cho menu hover/active */
.main-nav a:hover,
.main-nav li.current-menu-item a {
    background-image: linear-gradient(270deg, #b31d2f 0.68%, #7550a8 36.18%, #685ab4 51.41%, #2e75d8 66%, #94b0e8 83.6%, #50bbca 98.86%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
}

/* Sau khi scroll: màu chữ + icon nav đổi về tối/primary */
.site-header.scrolled .main-nav a {
    color: var(--clr-text, #222);
    text-shadow: none;
}
.site-header.scrolled .main-nav a i {
    color: var(--clr-primary) !important;
}
.site-header.scrolled .main-nav a:hover,
.site-header.scrolled .main-nav li.current-menu-item a {
    /* Đã được style bằng gradient text và gạch chân ở trên, không cần override color nữa */
}

/* MEGAMENU SYSTEM */
.has-megamenu { position: static; }
.megamenu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    padding: 24px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 999;
    border-top: 3px solid var(--clr-primary);
}
.has-megamenu:hover .megamenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.megamenu-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: stretch;
}
.megamenu-col {
    border-right: none;
    padding-right: 0;
    border-bottom: 1px dashed #eee;
    padding-bottom: 20px;
}
.megamenu-col:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

@media (max-width: 1200px) {
    .megamenu-grid {
        flex-direction: column;
        gap: 20px;
    }
    .megamenu-col {
        border-bottom: 1px dashed #eee;
        padding-bottom: 15px;
    }
}

.megamenu-col h4 {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--col-color, var(--clr-primary));
    margin-bottom: 16px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--col-border, rgba(0, 52, 120, 0.12));
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.megamenu-col ul {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 15px;
}

.megamenu-col li { margin-bottom: 0; }
.megamenu-col ul li a {
    font-weight: 500;
    font-size: 13px;
    color: #444;
    padding: 0 !important;
    text-transform: none;
    box-shadow: none !important;
    transition: 0.2s;
    display: block;
}
.megamenu-car-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    transition: all 0.25s ease;
    border-radius: 8px;
    background: #fdfdfd;
    border: 1px solid #eef2f6;
    min-width: 180px;
}
.megamenu-car-item:hover {
    background: #f4f7fa;
    border-color: var(--col-border, rgba(0, 52, 120, 0.15));
    box-shadow: 0 4px 12px var(--col-shadow, rgba(0, 52, 120, 0.05));
    transform: translateY(-2px);
}
.megamenu-car-thumb {
    width: 65px;
    height: 38px;
    flex-shrink: 0;
    background: transparent;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.megamenu-car-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}
.megamenu-col ul li a:hover .megamenu-car-thumb img {
    transform: scale(1.1) translateX(2px);
}
.megamenu-car-name {
    line-height: 1.2;
    font-weight: 700;
    font-size: 11.5px;
    color: #333;
    transition: color 0.2s;
}
.megamenu-col ul li a:hover .megamenu-car-name {
    color: var(--col-color, var(--clr-primary));
}

@media (max-width: 991px) {
    .megamenu-grid { grid-template-columns: repeat(3, 1fr); }
}

.header-right { display: flex; align-items: center; gap: 20px; }
.header-contact { display: flex; align-items: center; gap: 10px; text-align: right; }
.header-contact .icon {
    color: rgba(255,255,255,0.9);
    font-size: 24px;
    transition: color 0.3s ease;
}
.header-contact b {
    display: block;
    color: rgba(255,255,255,0.95);
    font-size: 16px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
    transition: color 0.3s ease;
}
.header-contact span {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    transition: color 0.3s ease;
}

/* Sau scroll: header contact đổi màu */
.site-header.scrolled .header-contact .icon { color: var(--clr-primary); }
.site-header.scrolled .header-contact b { color: var(--clr-primary); text-shadow: none; }
.site-header.scrolled .header-contact span { color: var(--clr-text-muted); }

@media (max-width: 768px) {
    .header-main { height: 70px; }
    .logo img { height: 60px !important; }
    .header-contact, .header-right .btn-red { display: none; }
}
