/* assets/css/responsive.css — Адаптивная навигация и нижняя панель мобильного */

/* === Иконки навигации === */
.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    /* currentColor из SVG не работает при <img src>, поэтому используем фильтр */
    filter: brightness(0) saturate(100%) invert(86%) sepia(8%) saturate(1214%) hue-rotate(8deg) brightness(98%) contrast(91%);
    opacity: 0.85;
}
.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    opacity: 1;
    filter: brightness(0) saturate(100%) invert(82%) sepia(34%) saturate(928%) hue-rotate(8deg) brightness(101%) contrast(91%);
}

.logo-icon {
    width: 22px;
    height: 22px;
    filter: brightness(0) saturate(100%) invert(82%) sepia(34%) saturate(928%) hue-rotate(8deg) brightness(101%) contrast(91%);
    vertical-align: middle;
    margin-right: 4px;
}

/* === Пункт навигации === */
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    text-decoration: none;
}
.nav-link:hover {
    background: var(--bg-hover);
    color: var(--accent-gold);
}
.nav-link.active {
    background: rgba(212,175,55,0.15);
    color: var(--accent-gold);
}

/* Бейдж уровня в пункте профиля */
.nav-level-badge {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-indigo));
    color: #fff;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

/* Кнопка регистрации — акцентная */
.nav-link.btn-register {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-indigo));
    color: #fff;
    font-weight: 600;
}
.nav-link.btn-register:hover {
    opacity: 0.9;
    color: #fff;
}
.nav-link.btn-register .nav-icon {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.nav-link.nav-admin {
    background: linear-gradient(135deg, var(--accent-gold), #f5d76e);
    color: #1a1530;
    font-weight: 600;
}
.nav-link.nav-admin:hover {
    color: #1a1530;
    opacity: 0.9;
}
.nav-link.nav-admin .nav-icon {
    filter: brightness(0) invert(0);
    opacity: 1;
}

/* === Структура шапки === */
.header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: nowrap;
}
.site-header .logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 1px;
    white-space: nowrap;
    margin-right: auto;
}
.nav-desktop {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Бургер скрыт по умолчанию */
.nav-burger {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.nav-burger:hover {
    border-color: var(--accent-gold);
}
.nav-burger .nav-icon {
    width: 22px;
    height: 22px;
}

/* === Мобильное overlay-меню === */
.nav-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 12, 30, 0.96);
    backdrop-filter: blur(8px);
    z-index: 1100;
    flex-direction: column;
    padding: 16px;
}
.nav-mobile-overlay.open {
    display: flex;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.nav-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.nav-mobile-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-gold);
}
.nav-mobile-close {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nav-mobile-close:hover { border-color: var(--danger); }
.nav-mobile-close .nav-icon { width: 22px; height: 22px; }

.nav-mobile {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nav-mobile .nav-link {
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 10px;
    width: 100%;
    justify-content: flex-start;
}
.nav-mobile .nav-link .nav-icon {
    width: 22px;
    height: 22px;
}
.nav-mobile .nav-link.btn-register,
.nav-mobile .nav-link.nav-admin {
    margin-top: 8px;
    justify-content: center;
}

/* === Адаптивные брейкпоинты === */

/* Планшет — горизонтальный скролл без переноски */
@media (max-width: 1100px) {
    .site-header .logo {
        font-size: 18px;
    }
    .nav-desktop {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 2px;
    }
    .nav-desktop::-webkit-scrollbar { display: none; }
    .nav-link {
        flex-shrink: 0;
    }
}

/* Мобильный — бургер */
@media (max-width: 720px) {
    .header-inner {
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    .site-header .logo {
        margin-right: 0;
        font-size: 17px;
    }
    .logo-icon { width: 18px; height: 18px; }
    .nav-desktop {
        display: none;
    }
    .nav-burger {
        display: flex;
    }
}

/* Очень маленький экран */
@media (max-width: 380px) {
    .site-header .logo {
        font-size: 15px;
    }
}

/* === Нижняя фиксированная панель (мобильный) === */
.mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(21, 17, 48, 0.98) 0%, rgba(15, 12, 30, 1) 100%);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--accent-gold);
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 999;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
    justify-content: space-around;
    align-items: center;
}
.mbb-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    line-height: 1.2;
    transition: color 0.15s, background 0.15s;
    flex: 1;
    min-width: 0;
    max-width: 80px;
}
.mbb-btn .mbb-icon {
    width: 22px;
    height: 22px;
    filter: brightness(0) saturate(100%) invert(74%) sepia(5%) saturate(247%) hue-rotate(8deg) brightness(94%) contrast(91%);
    opacity: 0.7;
    transition: filter 0.15s, opacity 0.15s;
}
.mbb-btn .mbb-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-weight: 500;
}
.mbb-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
}
.mbb-btn:hover .mbb-icon {
    opacity: 1;
}
.mbb-btn.active {
    color: var(--accent-gold);
}
.mbb-btn.active .mbb-icon {
    opacity: 1;
    filter: brightness(0) saturate(100%) invert(82%) sepia(34%) saturate(928%) hue-rotate(8deg) brightness(101%) contrast(91%);
}

@media (max-width: 720px) {
    .mobile-bottom-bar {
        display: flex;
    }
    /* Отступ снизу чтобы нижняя панель не перекрывала контент */
    body {
        padding-bottom: 70px;
    }
    /* Если есть футер — добавляем ещё отступ */
    .site-footer {
        margin-bottom: 60px;
    }
    /* Чтобы фикс-панель не закрывала модалки — у них свой z-index выше */
}

@media (max-width: 380px) {
    .mbb-btn {
        padding: 5px 4px;
        font-size: 9px;
    }
    .mbb-btn .mbb-icon {
        width: 20px;
        height: 20px;
    }
}

/* === Адаптация контента === */
@media (max-width: 720px) {
    .hero {
        padding: 40px 16px 30px;
    }
    .hero h1 {
        font-size: 24px;
        line-height: 1.2;
    }
    .section {
        padding: 30px 12px;
    }
    .container {
        padding: 0 12px;
    }
    /* Уменьшаем сетки */
    .grid-2 {
        grid-template-columns: 1fr !important;
    }
    .grid-3 {
        grid-template-columns: 1fr !important;
    }
    .grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* Кнопки крупнее на мобиле */
    .btn {
        font-size: 14px;
        padding: 10px 16px;
    }
    .btn-lg {
        font-size: 15px;
        padding: 12px 20px;
        width: 100%;
    }
    /* Модалки поверх нижней панели */
    .visual-modal {
        z-index: 1200;
    }
    /* Админка — компактнее */
    .admin-layout {
        grid-template-columns: 1fr !important;
    }
    .admin-side {
        position: sticky;
        top: 0;
        z-index: 100;
        overflow-x: auto;
        white-space: nowrap;
    }
    .admin-side a {
        display: inline-block !important;
    }
}

@media (max-width: 480px) {
    .grid-4 {
        grid-template-columns: 1fr !important;
    }
    .hero h1 {
        font-size: 22px;
    }
}
