/* Шапка сайта */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 13, 26, 0.5);
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: var(--z-fixed);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    padding-top: max(0px, env(safe-area-inset-top));
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Скрытие хедера при открытии модальных окон */
.site-header.modal-open {
    transform: translateY(-100%) !important;
    pointer-events: none !important;
}

.site-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: -1;
    pointer-events: none;
}

.site-header.scrolled {
    background: rgba(10, 13, 26, 0.7);
    border-bottom-color: rgba(139, 92, 246, 0.2);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

.site-header.scrolled::before {
    backdrop-filter: blur(25px) saturate(200%);
    -webkit-backdrop-filter: blur(25px) saturate(200%);
}

.site-header .logo {
    isolation: isolate;
    position: relative;
    z-index: 1;
    mix-blend-mode: normal;
}

.site-header .logo svg.logo-image {
    mix-blend-mode: normal;
    isolation: isolate;
    position: relative;
    z-index: 1;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px max(20px, env(safe-area-inset-left)) 9px max(20px, env(safe-area-inset-right));
    max-width: 1400px;
    margin: 0 auto;
    gap: 20px;
    min-width: 0;
    box-sizing: border-box;
}

.header-nav-group {
    display: flex;
    align-items: center;
    gap: 38px;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    flex-shrink: 1;
    min-width: 0;
    isolation: isolate;
}

.logo-image,
.logo svg.logo-image {
    height: 60px;
    width: auto;
    max-width: 336px;
    display: block;
}

.logo svg.logo-image {
    object-fit: contain;
}

.logo svg.logo-image text {
    fill: url(#healthMapGold);
    fill-opacity: 1;
    paint-order: fill stroke;
}

.logo svg.logo-image line {
    stroke: url(#healthMapGold);
    stroke-opacity: 1;
    paint-order: stroke fill;
}

.main-nav {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.main-nav ul {
    display: flex;
    align-items: center;
    gap: 38px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    font-size: 15px;
    font-weight: 500;
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.2s, transform 0.2s, text-shadow 0.2s;
    position: relative;
    padding: 10px 0;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-align: center;
}

.nav-icon {
    display: none;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    fill: currentColor;
}

.nav-text {
    position: relative;
    display: inline-block;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: calc(100% + 16px);
    height: calc(100% + 8px);
    background: radial-gradient(ellipse at center, 
        rgba(251, 191, 36, 0.08) 0%, 
        rgba(245, 158, 11, 0.05) 50%,
        transparent 100%);
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: -1;
    pointer-events: none;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1.5px;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(251, 191, 36, 0.8) 20%,
        #fbbf24 50%,
        rgba(245, 158, 11, 0.8) 80%,
        transparent 100%);
    border-radius: 2px;
    transition: width 0.2s, opacity 0.2s;
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.6),
                0 0 24px rgba(251, 191, 36, 0.3);
    filter: blur(0.5px);
    transform-origin: center;
}

.nav-text::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1.5px;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(251, 191, 36, 0.8) 20%,
        #fbbf24 50%,
        rgba(245, 158, 11, 0.8) 80%,
        transparent 100%);
    border-radius: 2px;
    transition: width 0.2s, opacity 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.6),
                0 0 24px rgba(251, 191, 36, 0.3);
    filter: blur(0.5px);
    transform-origin: center;
}

.nav-link:hover {
    color: #fbbf24;
    transform: translateY(-1px);
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

.nav-link:hover::before {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.nav-link:hover::after {
    width: 0;
}

.nav-link:hover .nav-text::after {
    width: 100%;
    box-shadow: 0 0 16px rgba(251, 191, 36, 0.8),
                0 0 32px rgba(251, 191, 36, 0.4),
                0 2px 8px rgba(251, 191, 36, 0.2);
}

.nav-link:active {
    transform: translateY(0);
}

.telegram-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, rgba(0, 136, 204, 0.5) 0%, rgba(0, 102, 170, 0.5) 100%);
    color: #ffffff;
    text-decoration: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 136, 204, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    white-space: nowrap;
}

.telegram-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: currentColor;
}

.telegram-btn:hover {
    background: linear-gradient(135deg, rgba(0, 153, 221, 0.5) 0%, rgba(0, 119, 187, 0.5) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.2);
}

.telegram-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 136, 204, 0.3);
}

/* Десктоп (>1024px) */
@media (min-width: 1025px) {
    .header-content {
        gap: 20px;
    }
    
    .header-nav-group {
        gap: 38px;
    }
    
    .main-nav ul {
        gap: 38px;
    }
}

/* Планшеты (769px-1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .header-content {
        gap: 16px;
        padding: 9px max(20px, env(safe-area-inset-left)) 9px max(20px, env(safe-area-inset-right));
    }
    
    .header-nav-group {
        gap: 10px;
    }
    
    .main-nav ul {
        gap: 10px;
    }
    
    .nav-link {
        font-size: 13px;
        padding: 6px 12px;
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(124, 58, 237, 0.3) 100%);
        border: 1px solid rgba(139, 92, 246, 0.2);
        border-radius: 8px;
        color: #e8eef3;
        height: 32px;
        transition: background-color 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    }
    
    .nav-link::after,
    .nav-link::before,
    .nav-text::after {
        display: none;
    }
    
    .nav-link .nav-icon {
        display: block;
        width: 16px;
        height: 16px;
    }
    
    .nav-link:hover {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.4) 0%, rgba(124, 58, 237, 0.4) 100%);
        border-color: rgba(139, 92, 246, 0.3);
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
        text-shadow: none;
    }
    
    .telegram-btn {
        padding: 6px 12px;
        font-size: 13px;
        height: 32px;
        border-radius: 8px;
    }
    
    .telegram-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* Мобильные (≤768px) */
@media (max-width: 768px) {
    .site-header {
        background: rgba(10, 13, 26, 0.8);
    }
    
    .site-header::before {
        backdrop-filter: blur(25px) saturate(200%);
        -webkit-backdrop-filter: blur(25px) saturate(200%);
    }
    
    .site-header.scrolled {
        background: rgba(10, 13, 26, 0.9);
    }
    
    .site-header.scrolled::before {
        backdrop-filter: blur(25px) saturate(200%);
        -webkit-backdrop-filter: blur(25px) saturate(200%);
    }
    
    .header-content {
        padding: 8px max(16px, env(safe-area-inset-left)) 8px max(16px, env(safe-area-inset-right));
        gap: 8px;
    }
    
    .header-nav-group {
        gap: 8px;
    }
    
    .main-nav ul {
        gap: 8px;
    }
    
    .logo {
        max-width: calc(100% - 140px);
    }
    
    .logo-image,
    .logo svg.logo-image {
        height: 48px;
        max-width: 262px;
        width: auto;
    }
    
    .nav-link {
        font-size: 0;
        padding: 8px;
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(124, 58, 237, 0.3) 100%);
        border: 1px solid rgba(139, 92, 246, 0.2);
        border-radius: 8px;
        color: #e8eef3;
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        gap: 0;
        transition: background-color 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    }
    
    .nav-link::after,
    .nav-link::before,
    .nav-text::after {
        display: none;
    }
    
    .nav-link .nav-icon {
        display: block;
        width: 18px;
        height: 18px;
    }
    
    .nav-link:hover {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.4) 0%, rgba(124, 58, 237, 0.4) 100%);
        border-color: rgba(139, 92, 246, 0.3);
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
        text-shadow: none;
    }
    
    .nav-link .nav-text {
        display: none;
    }
    
    .telegram-btn {
        padding: 8px;
        font-size: 0;
        gap: 0;
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }
    
    .telegram-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .telegram-btn span {
        display: none;
    }
}

/* Маленькие мобильные (≤480px) */
@media (max-width: 480px) {
    .header-content {
        gap: 6px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
    
    .header-nav-group {
        gap: 6px;
    }
    
    .main-nav ul {
        gap: 6px;
    }
    
    .logo {
        max-width: calc(100% - 120px);
    }
    
    .logo-image,
    .logo svg.logo-image {
        height: 44px;
        max-width: 186px;
        width: auto;
    }
}

/* Очень маленькие (≤360px) */
@media (max-width: 360px) {
    .header-content {
        gap: 4px;
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
    }
    
    .logo {
        max-width: calc(100% - 100px);
    }
    
    .logo-image,
    .logo svg.logo-image {
        height: 40px;
        max-width: 150px;
        width: auto;
    }
    
    .header-nav-group {
        gap: 4px;
    }
    
    .main-nav ul {
        gap: 4px;
    }
    
    .nav-link {
        padding: 6px;
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
    }
    
    .nav-link .nav-icon {
        width: 16px;
        height: 16px;
    }
    
    .telegram-btn {
        padding: 6px;
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
    }
    
    .telegram-btn svg {
        width: 16px;
        height: 16px;
    }
}
