/* ===== HEADER STYLES ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #FFFFFF;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: all 0.3s ease;
}

.header__container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.header__top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    gap: 1rem;
    padding-bottom: 0.5rem;
}

.header__bottom-row {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0 1rem 0;
}

/* ===== HEADER LOGO ===== */
.header__logo {
    flex-shrink: 0;
}

.header__logo-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.header__logo-link:hover {
    transform: translateY(-1px);
}

.header__logo-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
}

.header__logo-text {
    display: flex;
    flex-direction: column;
}

.header__logo-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: #2C2C2C;
    margin: 0;
    line-height: 1.2;
}

.header__logo-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    color: #666666;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== HEADER NAVIGATION ===== */
.header__nav {
    flex: 1;
    display: flex;
    justify-content: center;
    margin: 0 2rem;
}

.header__menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header__menu-item {
    position: relative;
}

.header__menu-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: #2C2C2C;
    border-radius: 2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.header__menu-link:hover {
    background: rgba(44, 44, 44, 0.08);
    color: #2C2C2C;
    transform: translateY(-1px);
}

.header__menu-link--active,
.header__menu-link.header__menu-link--active {
    background: linear-gradient(135deg, rgba(148, 109, 70, 0.15) 0%, rgba(148, 109, 70, 0.25) 100%) !important;
    color: #946D46 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(148, 109, 70, 0.2) !important;
    border: 1px solid rgba(148, 109, 70, 0.3) !important;
}

.header__menu-link i {
    font-size: 0.85rem;
    opacity: 0.8;
}

.header__menu-link span {
    transition: color 0.3s ease;
}

/* ===== MOBILE MENU TOGGLE ===== */
.header__mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.header__mobile-toggle:hover {
    background: rgba(44, 44, 44, 0.08);
}

.header__mobile-toggle-bar {
    width: 24px;
    height: 2px;
    background: #2C2C2C;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.header__mobile-toggle.active .header__mobile-toggle-bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.header__mobile-toggle.active .header__mobile-toggle-bar:nth-child(2) {
    opacity: 0;
}

.header__mobile-toggle.active .header__mobile-toggle-bar:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .header__container {
        padding: 0 1.5rem;
    }
    
    .header__menu {
        gap: 0.25rem;
    }
    
    .header__menu-link {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    .header__logo-title {
        font-size: 1.1rem;
    }
    
    .header__logo-subtitle {
        font-size: 0.65rem;
    }
    
    .header__nav {
        margin: 0 1rem;
    }
}

@media (max-width: 900px) {
    .header__logo-title {
        font-size: 1rem;
    }
    
    .header__logo-subtitle {
        font-size: 0.6rem;
    }
    
    .header__menu-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .header__nav {
        margin: 0 0.5rem;
    }
}

@media (max-width: 768px) {
    .header__container {
        padding: 0 1rem;
    }
    
    .header__top-row {
        height: 70px;
        position: relative;
    }
    
    .header__bottom-row {
        padding: 0.75rem 0;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .search-form {
        padding: 0.5rem 1rem;
    }
    
    .search-input {
        font-size: 0.9rem;
        margin: 0 0.75rem;
    }
    
    .search-submit-button {
        width: 36px;
        height: 36px;
    }
    
    .header__nav {
        position: fixed;
        top: calc(70px + 60px); /* Account for bottom row */
        left: 0;
        right: 0;
        background: #FFFFFF;
        border-top: 1px solid rgba(44, 44, 44, 0.1);
        margin: 0;
        padding: 1rem;
        transform: translateY(-100vh);
        transition: transform 0.3s ease;
        z-index: 1001; /* Higher than search dropdown */
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
        max-height: calc(100vh - 130px); /* Ensure it doesn't exceed viewport */
        overflow-y: auto; /* Allow scrolling if menu is too long */
    }
    
    .header__nav.active {
        transform: translateY(0);
    }
    
    .header__menu {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        align-items: center;
        justify-content: center;
    }
    
    .header__menu-item {
        width: 100%;
        display: flex;
        justify-content: center;
    }
    
    .header__menu-link {
        width: 100%;
        max-width: 300px; /* Limit width for better appearance */
        justify-content: center;
        padding: 1rem 1.5rem;
        border-radius: 1rem;
        font-size: 0.9rem;
        text-align: center;
    }
    
    .header__mobile-toggle {
        display: flex;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        z-index: 1002;
    }
    
    .header__logo-text {
        display: none;
    }
    
    .header__logo-image {
        width: 40px;
        height: 40px;
    }
    
    .language-switcher__dropdown {
        right: -1rem;
    }
}

@media (max-width: 480px) {
    .header__container {
        padding: 0 0.75rem;
    }
    
    .header__nav {
        padding: 0.75rem;
        max-height: calc(100vh - 120px);
    }
    
    .header__menu-link {
        max-width: 280px;
        padding: 0.875rem 1.25rem;
        font-size: 0.85rem;
    }
    
    .language-switcher__current {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
        min-width: 70px;
    }
    
    .language-switcher__dropdown {
        min-width: 140px;
        right: -0.5rem;
    }
}

/* ===== HEADER SCROLL EFFECT ===== */
.header.scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12);
}

.header.scrolled .header__container {
    height: 70px;
}

.header.scrolled .header__logo-image {
    width: 45px;
    height: 45px;
}

.header.scrolled .header__logo-title {
    font-size: 1.3rem;
}

/* ===== HEADER ANIMATIONS ===== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header {
    animation: fadeInDown 0.6s ease forwards;
}

.header__menu-item {
    animation: fadeInDown 0.6s ease forwards;
}

.header__menu-item:nth-child(1) { animation-delay: 0.1s; }
.header__menu-item:nth-child(2) { animation-delay: 0.2s; }
.header__menu-item:nth-child(3) { animation-delay: 0.3s; }
.header__menu-item:nth-child(4) { animation-delay: 0.4s; }
.header__menu-item:nth-child(5) { animation-delay: 0.5s; }
.header__menu-item:nth-child(6) { animation-delay: 0.6s; } 

/* ===== BODY MARGIN TO AVOID HEADER OVERLAP ===== */
body {
    margin-top: 140px; /* Top row (80px) + Bottom row toggle (60px) */
}

@media (max-width: 768px) {
    body {
        margin-top: 130px; /* Top row (70px) + Bottom row toggle (60px) */
    }
}

@media (max-width: 480px) {
    body {
        margin-top: 120px; /* Thấp hơn vì toggle button nhỏ hơn */
    }
}

/* ===== SEARCH TOGGLE BUTTON ===== */
.search-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, #946D46 0%, #8B6441 100%);
    border: none;
    border-radius: 2rem;
    color: #FFFFFF;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(148, 109, 70, 0.3);
    min-width: 150px;
    justify-content: center;
}

.search-toggle-btn:hover {
    background: linear-gradient(135deg, #8B6441 0%, #7A5638 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(148, 109, 70, 0.4);
}

.search-toggle-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(148, 109, 70, 0.3);
}

.search-toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.search-toggle-btn.active .search-toggle-icon {
    transform: rotate(180deg);
}

/* ===== SEARCH DROPDOWN ===== */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-top: 1px solid rgba(148, 109, 70, 0.2);
    padding: 1.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.search-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-dropdown .search-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ===== RESPONSIVE FOR SEARCH TOGGLE ===== */
@media (max-width: 768px) {
    .search-toggle-btn {
        padding: 0.6rem 1.5rem;
        font-size: 0.85rem;
        min-width: 130px;
        gap: 0.5rem;
    }
    
    .search-dropdown .search-container {
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .search-toggle-btn {
        padding: 0.5rem 1.25rem;
        font-size: 0.8rem;
        min-width: 120px;
    }
    
    .search-dropdown {
        padding: 1rem 0;
    }
}

/* === ELFSIGHT TRANSLATOR WIDGET === */
.header__translator {
    display: flex;
    align-items: center;
    margin-left: 16px;
    /* Đẩy sát phải */
    margin-right: 0;
}

/* Đảm bảo widget không bị lệch so với menu */
.header__top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Responsive: Khi ở mobile, chuyển widget xuống dưới menu hoặc ẩn nếu cần */
@media (max-width: 900px) {
    .header__translator {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
        justify-content: flex-end;
        order: 3;
    }
    .header__top-row {
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .header__translator {
        margin-top: 8px;
        width: 100%;
        justify-content: flex-end;
        order: 3;
    }
}

@media (max-width: 768px) {
    .header__translator {
        display: none;
    }
}