/* Mobile Menu Positioning Fix - Modern 2025 Design */
@media(max-width:1023px){
    .header__inner {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas: 
            "logo theme menu"
            "search search search";
        align-items: center;
        gap: 12px;
    }
    
    .logo {
        grid-area: logo;
        margin-left: 8px;
    }
    
    .theme-toggle {
        grid-area: theme;
        margin: 0;
        justify-self: center;
    }
    
    .menu-toggle {
        grid-area: menu;
        justify-self: end;
        margin-right: 8px;
        position: relative;
        z-index: 1002;
    }
    
    /* Fullscreen Modern Mobile Menu - No Inner Scroll */
    .nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg);
        display: none;
        z-index: 1000;
        opacity: 0;
        transform: translateX(100%);
        transition: opacity 0.3s ease, transform 0.3s ease;
        padding-top: 80px;
        padding-bottom: 20px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav.active {
        display: flex;
        height: fit-content;
        opacity: 1;
        transform: translateX(0);
    }
    
    .nav__list {
        width: 100%;
        max-width: 100%;
        padding: 0 20px;
        display: flex;
        flex-direction: column;
    }
    
    .nav__item {
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;
    }
    
    .nav__link {
        padding: 16px 12px;
        font-size: 17px;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 54px;
    }
    
    .header-search {
        grid-area: search;
        width: 100%;
    }
    
    /* Mobile Multilevel Menu - Modern Design */
    .nav__item--has-submenu > .nav__link::after {
        content: '▼';
        font-size: 12px;
        margin-left: auto;
        transition: transform 0.3s ease;
        color: var(--muted);
    }
    
    .nav__item--has-submenu.open > .nav__link::after {
        transform: rotate(180deg);
        color: var(--brand);
    }
    
    .nav__submenu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        background: var(--surface);
        border-radius: 8px;
        margin: 0 0 8px 0;
    }
    
    .nav__item--has-submenu.open > .nav__submenu {
        max-height: 2000px;
        padding: 8px 0;
    }
    
    .nav__submenu a {
        padding: 14px 24px;
        font-size: 16px;
        font-weight: 500;
        display: flex;
        align-items: center;
        color: var(--text);
        transition: all 0.2s ease;
    }
    
    .nav__submenu a:hover,
    .nav__submenu a:active {
        background: var(--brand);
        color: #fff;
        padding-left: 32px;
    }
    
    .nav__submenu-item--has-children > a::after {
        content: '›';
        font-size: 20px;
        margin-left: auto;
        transition: transform 0.3s ease;
        color: var(--muted);
    }
    
    .nav__submenu-item--has-children.open > a::after {
        transform: rotate(90deg);
        color: var(--brand);
    }
    
    .nav__submenu-level3 {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        background: var(--surface-elevated);
        border-radius: 6px;
        margin: 4px 12px;
    }
    
    .nav__submenu-item--has-children.open > .nav__submenu-level3 {
        max-height: 1000px;
        padding: 4px 0;
    }
    
    .nav__submenu-level3 a {
        padding: 12px 20px;
        font-size: 15px;
        font-weight: 400;
    }
    
    /* Close button overlay effect */
    body.mobile-menu-open {
        overflow: hidden;
    }
    
    body.mobile-menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        animation: fadeIn 0.3s ease;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

/* Desktop positioning - Vertically centered */
@media(min-width:1024px){
    .header__inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 20px;
        min-height: 72px;
        padding-top: 8px;
        padding-bottom: 8px;
    }
    
    .logo {
        order: 1;
        display: flex;
        align-items: center;
    }
    
    .nav {
        order: 2;
        flex: 1;
        display: flex;
        align-items: center;
    }
    
    .nav__list {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .nav__link {
        display: flex;
        align-items: center;
    }
    
    .header-search {
        order: 3;
        display: flex;
        align-items: center;
    }
    
    .theme-toggle {
        order: 4;
        display: flex;
        align-items: center;
    }
    
    .menu-toggle {
        display: none;
    }
}

/* Search bar responsive */
.header-search {
    display: flex;
    gap: 4px;
    max-width: 100%;
}

@media(min-width:640px){
    .header-search {
        max-width: 280px;
    }
}

.header-search__input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    transition: var(--transition);
}

.header-search__input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(196,30,58,0.1);
}

.header-search__btn {
    padding: 10px 16px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-search__btn:hover {
    background: var(--brand-dark);
    transform: scale(1.05);
}
