/* ============================================================
   ЕДИНОЕ НАВИГАЦИОННОЕ МЕНЮ
   ПК: сверху, горизонтальное
   Мобильные: снизу, с иконками
   ПАЛИТРА: "ТЕХНОЛОГИЧНЫЙ ИЗУМРУД"
   ============================================================ */

:root {
    --nav-bg: rgba(10, 37, 64, 0.92);
    --nav-border: rgba(0, 229, 153, 0.15);
    --nav-text: #A9B4C2;
    --nav-text-active: #00E599;
    --nav-hover-bg: rgba(0, 229, 153, 0.08);
    --nav-height-desktop: 64px;
    --nav-height-mobile: 68px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== ОБЩИЙ КОНТЕЙНЕР ===== */
.main-nav {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 900;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-color: var(--nav-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: transform 0.25s ease;
}

/* ===== ПК: СВЕРХУ ===== */
@media (min-width: 769px) {
    .main-nav {
        top: 0;
        height: var(--nav-height-desktop);
        border-bottom: 1px solid var(--nav-border);
        padding: 0 24px;
        gap: 4px;
    }
}

/* ===== МОБИЛЬНЫЕ: СНИЗУ ===== */
@media (max-width: 768px) {
    .main-nav {
        bottom: 0;
        height: calc(var(--nav-height-mobile) + var(--safe-bottom));
        padding-bottom: var(--safe-bottom);
        border-top: 1px solid var(--nav-border);
        justify-content: space-around;
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* ===== ПУНКТ МЕНЮ ===== */
.main-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--nav-text);
    border-radius: 12px;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    white-space: nowrap;
}

/* ПК: горизонтальный вид */
@media (min-width: 769px) {
    .main-nav .nav-item {
        flex-direction: row;
        gap: 8px;
        padding: 10px 18px;
        font-size: 15px;
        font-weight: 600;
        height: 44px;
    }

    .main-nav .nav-item i {
        font-size: 16px;
    }
}

/* Мобильные: вертикальный вид */
@media (max-width: 768px) {
    .main-nav .nav-item {
        flex: 1;
        padding: 8px 4px;
        font-size: 11px;
        font-weight: 600;
        max-width: 90px;
        gap: 4px;
    }

    .main-nav .nav-item i {
        font-size: 20px;
    }
}

/* Наведение/нажатие */
.main-nav .nav-item:hover,
.main-nav .nav-item:active {
    background: var(--nav-hover-bg);
    color: var(--nav-text-active);
}

/* Активный пункт */
.main-nav .nav-item.active {
    color: var(--nav-text-active);
}

.main-nav .nav-item.active::after {
    content: '';
    position: absolute;
    background: var(--nav-text-active);
    border-radius: 2px;
}

@media (min-width: 769px) {
    .main-nav .nav-item.active::after {
        bottom: 4px;
        left: 50%;
        transform: translateX(-50%);
        width: 24px;
        height: 2px;
    }
}

@media (max-width: 768px) {
    .main-nav .nav-item.active::after {
        top: 4px;
        left: 50%;
        transform: translateX(-50%);
        width: 20px;
        height: 3px;
        border-radius: 3px;
    }
}

/* Иконка активного пункта — изумрудное свечение */
.main-nav .nav-item.active i {
    filter: drop-shadow(0 0 6px rgba(0, 229, 153, 0.6));
}

/* ===== ОТСТУПЫ ДЛЯ КОНТЕНТА ===== */
@media (min-width: 769px) {
    body.has-main-nav {
        padding-top: calc(var(--nav-height-desktop) + 16px);
    }
}

@media (max-width: 768px) {
    body.has-main-nav {
        padding-bottom: calc(var(--nav-height-mobile) + var(--safe-bottom) + 16px);
    }
}

/* Кнопка "Назад" внутри хедера — изумрудная */
.header .back-btn,
.header .back-button {
    position: static !important;
    transform: none !important;
    margin-bottom: 12px;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(0, 229, 153, 0.1);
    border: 1px solid rgba(0, 229, 153, 0.3);
    border-radius: 40px;
    color: #00E599;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 1;
}

.header .back-btn:hover,
.header .back-button:hover {
    background: rgba(0, 229, 153, 0.2);
}

/* Заголовок хедера — убираем отступ под кнопку */
.header h1 {
    padding: 0 !important;
    text-align: center;
}

@media (max-width: 768px) {
    .header {
        text-align: left;
    }
    .header h1 {
        text-align: left;
        padding: 0 !important;
    }
}