/* Mobile Bottom Navigation Bar */
/* ================================================== */

/* Скрываем старые элементы */
.hamburger-btn {
    display: none !important;
}

.mobile-menu-overlay {
    display: none !important;
}

/* Нижняя навигация - скрыта на десктопе */
.mobile-bottom-nav {
    display: none;
}

/* ================================================== */
/* Мобильные стили */
/* ================================================== */
@media (max-width: 767px) {

    /* --- Верхний navbar: только логотип --- */
    .navbar {
        padding: 0.6rem 1rem;
        justify-content: center;
    }

    .navbar .nav-menu {
        display: none !important;
    }

    .navbar .nav-user {
        display: none !important;
    }

    .navbar .nav-auth {
        display: none !important;
    }

    .navbar .logo {
        flex-shrink: 0;
    }

    .navbar .logo-img {
        width: 32px;
        height: 32px;
    }

    .navbar .logo-text {
        font-size: 1rem;
    }

    /* --- Нижняя навигация --- */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9998;
        background: #ffffff;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
        padding: 0.4rem 0.25rem;
        padding-bottom: calc(0.4rem + env(safe-area-inset-bottom, 0px));
        justify-content: space-around;
        align-items: center;
        contain: layout style;
        transform: translateZ(0);
    }

    /* Элемент навигации */
    .mobile-bottom-nav__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #94a3b8;
        font-size: 0.6rem;
        font-weight: 500;
        gap: 0.2rem;
        padding: 0.35rem 0.5rem;
        border-radius: 12px;
        transition: all 0.2s ease;
        position: relative;
        min-width: 0;
        flex: 1;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
    }

    .mobile-bottom-nav__item i {
        font-size: 1.2rem;
        transition: transform 0.2s ease;
        background: linear-gradient(135deg, var(--color-blue, #3b82f6), var(--color-pink, #ec4899));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .mobile-bottom-nav__item span {
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        line-height: 1.15;
        text-align: center;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        word-break: break-word;
    }

    /* Активный элемент */
    .mobile-bottom-nav__item.active {
        color: #3b82f6;
    }

    .mobile-bottom-nav__item.active i {
        transform: scale(1.1);
        background: linear-gradient(135deg, var(--color-blue, #3b82f6), var(--color-pink, #ec4899));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .mobile-bottom-nav__item.active::before {
        content: '';
        position: absolute;
        top: -0.4rem;
        left: 50%;
        transform: translateX(-50%);
        width: 24px;
        height: 3px;
        background: linear-gradient(90deg, #3b82f6, #8b5cf6);
        border-radius: 0 0 3px 3px;
    }

    /* Нажатие */
    .mobile-bottom-nav__item:active,
    .mobile-bottom-nav__item.pressed {
        background: rgba(59, 130, 246, 0.12);
    }

    .mobile-bottom-nav__item:active i,
    .mobile-bottom-nav__item.pressed i {
        transform: scale(0.92);
    }

    .mobile-bottom-nav__item.navigating {
        opacity: 0.65;
        pointer-events: none;
    }

    body.mobile-nav-loading .mobile-bottom-nav__item:not(.navigating) {
        pointer-events: none;
        opacity: 0.5;
    }

    /* Отступ снизу у body, чтобы контент не перекрывался */
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    /* Футер тоже не перекрывается */
    .footer {
        margin-bottom: 0;
        padding-bottom: 0.5rem;
    }
}

/* Очень маленькие экраны */
@media (max-width: 360px) {
    .mobile-bottom-nav {
        padding: 0.3rem 0.15rem;
        padding-bottom: calc(0.3rem + env(safe-area-inset-bottom, 0px));
    }

    .mobile-bottom-nav__item {
        font-size: 0.55rem;
        padding: 0.3rem 0.25rem;
        gap: 0.15rem;
    }

    .mobile-bottom-nav__item i {
        font-size: 1.05rem;
    }

    .navbar {
        padding: 0.5rem 0.75rem;
    }

    .navbar .logo-img {
        width: 28px;
        height: 28px;
    }

    .navbar .logo-text {
        font-size: 0.9rem;
    }
}

/* Accessibility */
.mobile-bottom-nav__item:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) and (max-width: 767px) {
    .mobile-bottom-nav {
        background: #1e1e28;
        border-top-color: rgba(255, 255, 255, 0.08);
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3);
    }

    .mobile-bottom-nav__item {
        color: #64748b;
    }

    .mobile-bottom-nav__item.active {
        color: #60a5fa;
    }

    .mobile-bottom-nav__item.active::before {
        background: linear-gradient(90deg, #60a5fa, #a78bfa);
    }

    .mobile-bottom-nav__item:active {
        background: rgba(96, 165, 250, 0.1);
    }

    /* Тосты/ошибки — выше нижнего меню, не перекрываются */
    .notification {
        z-index: 10050 !important;
        bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px)) !important;
        left: 12px !important;
        right: 12px !important;
        max-width: none !important;
    }
}
