/**
 * Стили для нижней навигационной панели
 * Вынесено из base.html для оптимизации
 */

.bottom-navbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 100%;
    background: rgba(108, 117, 125, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border-radius: 15px 15px 0 0;
    margin-top: 0; /* Убираем зазор между белой областью и серой полосой */
}

/* Медиа-запросы для адаптивности навигации */
@media (max-width: 480px) {
    .bottom-navbar {
        padding: 10px 0;
        border-radius: 10px 10px 0 0;
    }
    
    .nav-btn {
        width: 50px;
        height: 50px;
        font-size: 14px;
    }
    
    .nav-btn img {
        width: 40px !important;
        height: 40px !important;
    }
    
    /* Уменьшаем gap между кнопками на маленьких экранах */
    .bottom-navbar .d-flex {
        gap: 8px !important;
    }
}

@media (min-width: 481px) and (max-width: 767px) {
    .bottom-navbar {
        padding: 12px 0;
    }
    
    .nav-btn {
        width: 55px;
        height: 55px;
    }
    
    .nav-btn img {
        width: 44px !important;
        height: 44px !important;
    }
}

/* На десктопе ограничиваем ширину как у main-wrapper */
@media (min-width: 768px) {
    .bottom-navbar {
        max-width: 70%;
    }
}

@media (min-width: 1024px) {
    .bottom-navbar {
        max-width: 60%;
    }
}

@media (min-width: 1440px) {
    .bottom-navbar {
        max-width: 50%;
    }
}

/* Для страниц с .auth-container убираем margin-bottom, чтобы не было зазора */
.auth-container:has(.card) {
    margin-bottom: 0;
    border-radius: 15px 15px 0 0;
    padding-bottom: 90px;
}

/* Учёт safe-area на мобильных (вырез, индикатор дома) */
@media (max-width: 768px) {
    .auth-container:has(.card) {
        padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    }
}

/* Для страниц без .card добавляем margin-bottom */
.auth-container:not(:has(.card)) {
    margin-bottom: 100px;
}

/* Для старых браузеров, которые не поддерживают :has() */
.auth-container .card {
    border-radius: 15px 15px 0 0;
}

.nav-btn {
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(222, 226, 230, 0.8);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #212529;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    /* Оптимизация для touch-устройств */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    /* Минимальный размер для удобного нажатия */
    min-width: 44px;
    min-height: 44px;
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 1);
    border-color: #adb5bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Для touch-устройств используем :active вместо :hover */
@media (hover: none) and (pointer: coarse) {
    .nav-btn:active {
        background-color: rgba(255, 255, 255, 1);
        border-color: #adb5bd;
        transform: scale(0.95);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
}

.nav-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.avatar-btn {
    cursor: pointer;
    border-radius: 50% !important;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Стили для аватара с индикатором в навигации */
.nav-btn.avatar-btn .avatar-with-status {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0;
    padding: 0;
}

.nav-btn.avatar-btn .avatar-with-status img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.nav-btn.avatar-btn .avatar-with-status > div.rounded-circle {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

/* Логотип в нижней навигации для десктопных версий */
.bottom-navbar-logo-desktop {
    display: none !important;
    text-align: center;
    margin-bottom: 10px;
    width: 100%;
    padding: 0 15px;
}

.bottom-navbar-logo-desktop .site-logo {
    max-width: 120px;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
    display: block;
    margin: 0 auto;
}

/* Показываем логотип в нижней навигации только на десктопе */
@media (min-width: 768px) {
    .bottom-navbar-logo-desktop {
        display: block !important;
        visibility: visible !important;
    }
    
    .bottom-navbar .container-fluid {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

/* Скрываем логотип в нижней навигации на мобильных */
@media (max-width: 767px) {
    .bottom-navbar-logo-desktop {
        display: none !important;
        visibility: hidden !important;
    }
}
