/*!
 * Menu Responsive Fix
 * Sửa lỗi menu xuống hàng khi chuyển ngôn ngữ
 */

/* Cải thiện layout nav container */
.nav-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 70px;
    position: relative;
}

/* Tối ưu logo area */
.nav-logo {
    flex-shrink: 0;
    max-width: 250px;
    min-width: 200px;
}

.logo-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.logo-main {
    display: flex;
    align-items: center;
    white-space: nowrap;
    margin-bottom: 2px;
}

.logo-slogan {
    font-size: 0.7rem !important;
    font-weight: 500;
    color: #64748b;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.2;
    transition: all 0.3s ease;
}

/* Menu area - flexible */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.8rem;
    margin: 0;
    padding: 0;
    flex-shrink: 1;
    min-width: 0;
}

.nav-menu a {
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Language switcher - fixed width */
.language-switcher {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

.lang-btn {
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
    min-width: 40px;
    white-space: nowrap;
}

/* Responsive breakpoints */
@media (max-width: 1200px) {
    .nav-menu {
        gap: 1.5rem;
    }
    
    .nav-menu a {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
    
    .logo-slogan {
        font-size: 0.65rem !important;
        max-width: 180px;
    }
}

@media (max-width: 1024px) {
    .nav-container {
        padding: 0 15px;
    }
    
    .nav-menu {
        gap: 1.2rem;
    }
    
    .nav-menu a {
        padding: 6px 8px;
        font-size: 0.85rem;
    }
    
    .logo-slogan {
        font-size: 0.6rem !important;
        max-width: 160px;
    }
    
    .lang-btn {
        padding: 5px 10px !important;
        font-size: 0.8rem !important;
        min-width: 35px;
    }
}

@media (max-width: 900px) {
    .nav-menu {
        gap: 1rem;
    }
    
    .nav-menu a {
        padding: 5px 6px;
        font-size: 0.8rem;
    }
    
    .logo-slogan {
        font-size: 0.55rem !important;
        max-width: 140px;
    }
}

/* Tooltip cho slogan khi bị cắt */
.logo-slogan[data-full-text]:hover::after {
    content: attr(data-full-text);
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    animation: tooltipFadeIn 0.3s ease forwards;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Đảm bảo menu không bao giờ xuống hàng */
@media (min-width: 769px) {
    .nav-container {
        flex-wrap: nowrap !important;
    }
    
    .nav-menu {
        display: flex !important;
        position: static !important;
        flex-direction: row !important;
        background: transparent !important;
        box-shadow: none !important;
        width: auto !important;
        left: auto !important;
        top: auto !important;
    }
}

/* Mobile menu fixes */
@media (max-width: 768px) {
    .nav-container {
        height: auto;
        min-height: 70px;
        padding: 10px 15px;
    }
    
    .nav-logo {
        max-width: none;
        min-width: auto;
    }
    
    .logo-slogan {
        font-size: 0.6rem !important;
        max-width: 150px;
    }
    
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 1rem 0;
        z-index: 999;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-menu li {
        margin: 0.5rem 0;
    }
    
    .nav-menu a {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        display: block;
    }
    
    .language-switcher {
        margin-left: 10px;
        gap: 5px;
    }
    
    .lang-btn {
        padding: 4px 8px !important;
        font-size: 0.75rem !important;
        min-width: 30px;
    }
    
    .nav-toggle {
        display: block;
        cursor: pointer;
        margin-left: 10px;
    }
    
    .nav-toggle span {
        display: block;
        width: 25px;
        height: 3px;
        margin: 5px auto;
        background-color: #333;
        transition: 0.3s;
    }
    
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }
    
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }
}

/* Cải thiện hiển thị trên màn hình rất rộng */
@media (min-width: 1400px) {
    .nav-menu {
        gap: 2.5rem;
    }
    
    .nav-menu a {
        padding: 8px 16px;
        font-size: 1rem;
    }
    
    .logo-slogan {
        font-size: 0.75rem !important;
        max-width: 220px;
    }
    
    .lang-btn {
        padding: 8px 14px !important;
        font-size: 0.9rem !important;
    }
}

/* Fix cho Edge browser */
@supports (-ms-ime-align: auto) {
    .nav-container {
        display: -ms-flexbox !important;
        -ms-flex-wrap: nowrap !important;
        -ms-flex-align: center !important;
        -ms-flex-pack: justify !important;
    }
    
    .nav-menu {
        display: -ms-flexbox !important;
        -ms-flex-direction: row !important;
    }
    
    .language-switcher {
        display: -ms-flexbox !important;
        -ms-flex-negative: 0 !important;
    }
}