/* Navigation styles for CoinTune Dashboard v4 */

.main-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(1.2) blur(6px);
    background: rgba(255,255,255,.95);
}

body.dark .main-nav {
    background: rgba(15,22,32,.95);
}

.nav-container {
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
}

/* Левая часть - основное меню */
.nav-menu {
    display: flex;
    gap: 4px;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: relative;  /* Добавить */
}

/* Индикатор прокрутки справа */
.nav-menu::after {
    content: '›';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to right, transparent, var(--card) 30%);
    pointer-events: none;
    font-size: 20px;
    color: var(--muted);
    opacity: 0;
    transition: opacity 0.3s;
}

/* Показываем индикатор когда можно прокручивать */
@media (max-width: 1024px) {
    .nav-menu::after {
        opacity: 1;
    }
}

.nav-menu::-webkit-scrollbar {
    display: none;
}

.nav-item {
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--fg);
    font-size: 14px;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-item:hover {
    background: rgba(0,0,0,0.05);
}

body.dark .nav-item:hover {
    background: rgba(255,255,255,0.05);
}

.nav-item.active {
    background: rgba(59,130,246,0.1);
    color: #3b82f6;
    font-weight: 500;
}

body.dark .nav-item.active {
    background: rgba(59,130,246,0.15);
}

/* Правая часть - контролы */
.nav-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-left: 20px;
}

.nav-user {
    font-size: 14px;
    color: var(--fg);
    padding: 6px 10px;
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
    white-space: nowrap;
}

body.dark .nav-user {
    background: rgba(255,255,255,0.03);
}

.nav-balance {
    font-size: 14px;
    color: var(--muted);
    font-family: monospace;
    white-space: nowrap;
}

.btn-logout {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
    border-color: rgba(239,68,68,0.2);
}

.btn-logout:hover {
    background: rgba(239,68,68,0.15);
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 12px;
        height: 48px;
    }
    
    .nav-menu {
        flex: 1;
        margin-right: 10px;
        padding-right: 20px; /* Отступ для индикатора */
    }
    
    .nav-item {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .nav-controls {
        gap: 8px;
    }
    
    /* Оставляем баланс видимым */
    .nav-balance {
        font-size: 12px;
        white-space: nowrap;
    }
    
    /* Скрываем только имя пользователя */
    .nav-user {
        display: none;
    }
}

@media (max-width: 480px) {
    .nav-container {
        height: 44px;
    }
    
    .nav-item {
        padding: 5px 8px;
        font-size: 12px;
    }
    
    .btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .chip {
        font-size: 11px;
        padding: 2px 6px;
    }
}

/* Индикатор прокрутки для мобильных */
@media (max-width: 768px) {

    
    .nav-menu.scrollable::after {
        opacity: 1;
    }
}

/* Статус фильтрации - компактный вид */
.nav-filter-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
    cursor: pointer;
    position: relative;
}

.nav-filter-status .filter-mode {
    font-size: 13px;
    font-weight: 500;
}

.nav-filter-status .filter-samples {
    font-size: 9px;
    opacity: 0.6;
    font-family: monospace;
}

/* Кастомный tooltip для статуса фильтрации */
.nav-filter-status .filter-tooltip {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--card, #fff);
    border: 1px solid var(--border, #e1e5ea);
    border-radius: 10px;
    padding: 12px 14px;
    min-width: 240px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.15s ease;
    font-size: 13px;
    line-height: 1.5;
    text-align: left;
}

.nav-filter-status:hover .filter-tooltip,
.nav-filter-status:focus .filter-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.filter-tooltip .tooltip-title {
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border, #e1e5ea);
}

.filter-tooltip .tooltip-row {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
}

.filter-tooltip .tooltip-row .label {
    color: var(--muted, #64748b);
}

.filter-tooltip .tooltip-row .value {
    font-weight: 500;
}

.filter-tooltip .tooltip-link {
    display: block;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border, #e1e5ea);
    color: var(--accent, #3b82f6);
    text-decoration: none;
    font-weight: 500;
}

.filter-tooltip .tooltip-link:hover {
    text-decoration: underline;
}

/* Стрелка tooltip */
.filter-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: var(--card, #fff);
    border-left: 1px solid var(--border, #e1e5ea);
    border-top: 1px solid var(--border, #e1e5ea);
    transform: rotate(45deg);
}

/* Индикатор подключения - цветной шарик */
#connectionStatus {
    width: 12px;
    height: 12px;
    min-width: 12px;   /* 2026-01-06: Защита от деформации в flex */
    min-height: 12px;
    flex: 0 0 auto;    /* Не растягивать и не сжимать */
    border-radius: 50%;
    border: none;
    transition: all 0.3s ease;
    cursor: help;
    padding: 0;
    font-size: 0;  /* скрываем текст */
}

#connectionStatus.connected {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16,185,129,0.5);
}

#connectionStatus.loading, #connectionStatus.idle {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245,158,11,0.5);
}

#connectionStatus.disconnected, #connectionStatus.error {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239,68,68,0.5);
}

/* Dashboard specific filters */
.dashboard-filters {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.filters-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 16px;
    align-items: center;
}

@media (max-width: 768px) {
    .filters-container {
        flex-wrap: wrap;
    }
}

/* Гамбургер меню */
.hamburger-menu {
    display: none;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 101;
}

.hamburger-menu span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--fg);
    margin: 5px auto;
    transition: all 0.3s ease;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Мобильные стили */
@media (max-width: 768px) {
    .hamburger-menu {
        display: block;
    }
    
    .nav-menu {
        position: fixed;
        top: 56px;
        left: -100%;
        width: 250px;
        height: calc(100vh - 56px);
        background: var(--card);
        flex-direction: column;
        padding: 20px;
        gap: 8px;
        overflow-y: auto;
        transition: left 0.3s ease;
        z-index: 100;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    body.dark .nav-menu {
        background: rgba(15,22,32,.98);
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-menu::after {
        display: none; /* Убираем индикатор прокрутки */
    }
    
    .nav-item {
        width: 100%;
        padding: 12px 16px;
        border-radius: 8px;
    }
    
    /* Оверлей для затемнения контента */
    .nav-overlay {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    
    .nav-overlay.active {
        display: block;
    }
}