/* FlexGram UI — нижняя навигация (iOS liquid glass pill bar) */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    /* --layer-bottom-offset — нижний инсет устройства или Telegram,
       смотря что больше: в фуллскрине env() про низ клиента не знает. */
    padding: 8px 12px max(10px, var(--layer-bottom-offset));
}

.nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 420px;
    margin: 0 auto;
    padding: 6px 8px;
    background: var(--bg-glass-thick);
    backdrop-filter: blur(60px) saturate(200%);
    -webkit-backdrop-filter: blur(60px) saturate(200%);
    border-radius: var(--border-radius-pill);
    border: 1px solid var(--glass-border);
    box-shadow:
        var(--glass-highlight),
        var(--glass-glow),
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.nav-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.5),
        transparent
    );
    opacity: 0.6;
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
    .nav-container {
        background: var(--bg-glass-thick);
        border-color: var(--glass-border);
        box-shadow:
            var(--glass-highlight),
            0 8px 32px rgba(0, 0, 0, 0.35);
    }

    .nav-item {
        color: rgba(235, 235, 245, 0.6);
    }
}

body.tg-dark-theme .nav-container,
:root[data-theme="dark"] .nav-container {
    background: var(--bg-glass-thick);
    border-color: var(--glass-border);
    box-shadow:
        var(--glass-highlight),
        0 8px 32px rgba(0, 0, 0, 0.3);
}

body.tg-dark-theme .nav-item,
:root[data-theme="dark"] .nav-item {
    color: rgba(235, 235, 245, 0.6);
}

body.tg-dark-theme .nav-item:hover,
body.tg-dark-theme .nav-item.active,
:root[data-theme="dark"] .nav-item:hover,
:root[data-theme="dark"] .nav-item.active {
    color: #0a84ff;
}

body.tg-dark-theme .nav-item.active,
:root[data-theme="dark"] .nav-item.active {
    background: rgba(10, 132, 255, 0.12);
}

/* Пять пунктов делят ширину пилюли поровну (flex: 1) и умеют сжиматься
   ниже своего содержимого (min-width: 0): фиксированные min-width и
   боковые паддинги по 14px не оставляли подписи места, и «Дашборд»
   превращался в «Дашбо…». */
.nav-item {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-tertiary);
    font-size: 10px;
    font-weight: 500;
    padding: 6px 3px;
    border-radius: var(--border-radius-pill);
    transition: all var(--duration-normal) var(--ease-spring);
    min-width: 0;
    min-height: 48px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-item:hover {
    text-decoration: none;
    color: var(--color-primary);
}

.nav-item.active {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

/* Размер задаём и через width/height (SVG-иконки Lucide), и через
   font-size (шрифтовые наборы вроде Boxicons): у глифа размеры блока
   не работают, и без font-size он унаследовал бы 10px от .nav-item. */
.nav-icon {
    width: 24px;
    height: 24px;
    font-size: 24px;
    line-height: 1;
    margin-bottom: 2px;
    transition: transform var(--duration-fast) var(--ease-spring);
}

.nav-item:active .nav-icon {
    transform: scale(0.85);
}

/* Подпись подстраивается под ширину устройства, а не обрезается: на
   узком экране шрифт уходит к 8.5px, с 420px и шире пилюля перестаёт
   расти (max-width у .nav-container) и размер фиксируется на 11px.
   2.5vw подобрано так, чтобы самое длинное слово в навигации («Дашборд»,
   «Платежи» — 7 букв) укладывалось в пятую часть пилюли целиком. */
.nav-label {
    font-size: clamp(8.5px, 2.5vw, 11px);
    line-height: 1;
    margin-top: 2px;
    font-weight: 500;
    letter-spacing: 0;
    max-width: 100%;
    white-space: nowrap;
}

.nav-item.active .nav-label {
    font-weight: 600;
}

.nav-badge {
    position: absolute;
    top: 0;
    right: 6px;
    background: var(--color-error);
    color: white;
    border-radius: var(--border-radius-pill);
    padding: 1px 5px;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    text-align: center;
    line-height: 1.3;
    box-shadow: 0 2px 6px rgba(255, 59, 48, 0.3);
}

/* Content spacing for nav */
.main-content {
    padding-bottom: 100px;
}

.container {
    padding-bottom: 30px;
}

.bot-detail-page,
.payments-page,
.profile-page {
    padding-bottom: 40px;
}

/* Press animation */
.nav-item:active {
    transform: scale(0.92);
}

/* Responsive */
/* На совсем узких экранах отыгрываем место у пилюли и иконок; размер
   подписи уже считает clamp() выше. */
@media (max-width: 340px) {
    .nav-container {
        padding: 4px;
    }

    .nav-icon {
        width: 21px;
        height: 21px;
        font-size: 21px;
    }
}
