/**
 * Bottom Navigation - мобильная навигация
 * Показывается только на экранах < 768px
 */

/* =============================================================================
   BOTTOM NAV BAR
   ============================================================================= */

.bottom-nav {
    display: none; /* По умолчанию скрыта */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-card, #fff);
    border-top: 1px solid var(--border-color, #e5e7eb);
    padding: 0.5rem 0.25rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0));
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    /* Добавляем отступ снизу для контента */
    .app-shell > main {
        padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0));
    }

    /* Скрываем футер на мобильных */
    .site-footer {
        display: none;
    }
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    min-width: 64px;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary, #6b7280);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:active {
    transform: scale(0.95);
    background: var(--bg-secondary, #f3f4f6);
}

.bottom-nav-item.active {
    color: var(--primary-color, #2563eb);
}

.bottom-nav-item.active .bottom-nav-icon {
    stroke-width: 2.5;
}

.bottom-nav-icon {
    width: 22px;
    height: 22px;
    stroke-width: 1.75;
}

.bottom-nav-label {
    font-size: 0.65rem;
    font-weight: 500;
    white-space: nowrap;
}

/* =============================================================================
   DRAWER (выдвижное меню "Ещё")
   ============================================================================= */

.bottom-nav-drawer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
    visibility: hidden;
}

.bottom-nav-drawer.is-open {
    pointer-events: auto;
    visibility: visible;
}

.bottom-nav-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bottom-nav-drawer.is-open .bottom-nav-drawer-overlay {
    opacity: 1;
}

.bottom-nav-drawer-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: var(--bg-card, #fff);
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.bottom-nav-drawer.is-open .bottom-nav-drawer-content {
    transform: translateY(0);
}

.bottom-nav-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-secondary, #f9fafb);
}

.bottom-nav-drawer-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.bottom-nav-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.15s ease;
}

.bottom-nav-drawer-close:hover {
    background: var(--bg-hover, #f3f4f6);
    color: var(--text-primary, #111827);
}

.bottom-nav-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0));
}

/* Drawer sections */
.drawer-section {
    padding: 0.5rem 0;
}

.drawer-section:not(:last-child) {
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    margin-bottom: 0.5rem;
}

.drawer-section-title {
    padding: 0.5rem 1.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #9ca3af);
}
.drawer-subsection-title {
    padding: 0.25rem 1.25rem 0.1rem;
    font-size: 0.75rem;
    color: var(--text-secondary, #6b7280);
}

.drawer-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem;
    color: var(--text-primary, #111827);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: background 0.1s ease;
}

.drawer-item:active {
    background: var(--bg-secondary, #f3f4f6);
}

.drawer-item-icon {
    width: 20px;
    height: 20px;
    color: var(--text-secondary, #6b7280);
    flex-shrink: 0;
}

/* =============================================================================
   HEADER MOBILE ADAPTATIONS
   ============================================================================= */

@media (max-width: 768px) {
    /* Скрываем основную навигацию */
    .site-header-v2 .header-nav {
        display: none;
    }

    /* Упрощаем хедер */
    .site-header-v2 {
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }

    /* Скрываем часть иконок в хедере */
    .site-header-v2 .header-tasks-btn,
    .site-header-v2 .header-approvals-btn,
    .site-header-v2 .header-pulse {
        display: none;
    }

    /* Бренд компактнее */
    .brand-name {
        display: none;
    }

    /* Меньше иконок */
    .header-actions {
        gap: 0.25rem;
    }

    .header-icon-btn {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .site-header-v2 {
        padding: 0.5rem 0.75rem;
    }

    /* Скрываем ещё больше иконок на маленьких экранах */
    .site-header-v2 .header-icon-btn[title="Мои документы"],
    .site-header-v2 .header-icon-btn[title="Справочники"],
    .site-header-v2 .header-icon-btn[title="AI Ассистент"] {
        display: none;
    }
}
