/* ─────────────────────────────────────────────────────
   Горизонтальный навбар НЕавторизованных (маркетинг, вход,
   регистрация) + сквозные компоненты оболочки: flash-тосты,
   impersonate-bar, billing-alert-bar.

   Навигация авторизованных — сайдбар v6 (sidebar.css, ui-guide §24).
   Подключается в base.html после globals.css.
───────────────────────────────────────────────────── */

/* ── Navbar (только анонимы) ── */
.nav-wrap {
    position: sticky;
    top: 0;
    z-index: var(--z-navbar);
    background: var(--surface-translucent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

/* Навбар — на всю ширину, горизонтальный padding совпадает с <main>:
   левая кромка логотипа выровнена с левой кромкой контента страницы.
   Контейнер var(--container) — только для маркетинговых страниц. */
.nav-container {
    width: 100%;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 62px;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.brand {
    display: inline-flex;
    align-items: center;
    margin-right: 10px;
    text-decoration: none;
}

.brand-logo {
    height: 24px;
    width: auto;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 11px;
    border-radius: 9px;
    font-size: var(--text-sm);
    color: var(--text);
    background: transparent;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.nav-link:hover {
    background: var(--neutral-bg);
    border-color: var(--border-interactive);
}

.nav-link.active {
    background: var(--hover-active);
    color: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
}

.auth-link {
    color: var(--primary);
    padding: 8px 10px;
    border-radius: 8px;
    font-size: var(--text-sm);
    font-weight: 600;
    transition: background .15s ease;
}

.auth-link:hover {
    background: var(--hover-active);
}

/* ── Flash-сообщения (fixed toast) ── */
.flash-wrap {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: min(920px, calc(100vw - 20px));
    z-index: var(--z-toast);
    pointer-events: none;
}

.flash {
    position: relative;
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: 10px;
    background: var(--surface);
    padding: 10px 38px 10px 12px;
    margin-bottom: 8px;
    font-size: var(--text-sm);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    transition: opacity .22s ease, transform .22s ease, max-height .22s ease,
                margin .22s ease, padding .22s ease, border-width .22s ease;
    max-height: 120px;
    overflow: hidden;
    pointer-events: auto;
}

.flash-success { border-left-color: var(--success-text); background: var(--success-bg); }
.flash-error   { border-left-color: var(--danger); background: var(--error-bg); }
.flash-warning { border-left-color: var(--warning-text); background: var(--warning-bg); }
.flash-info    { border-left-color: var(--primary); background: var(--hover-active); }

.flash.is-hiding {
    opacity: 0;
    transform: translateY(-4px);
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
}

.flash-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: var(--text-base);
    line-height: 24px;
    text-align: center;
    padding: 0;
    transition: background .15s ease, color .15s ease;
}

.flash-close:hover {
    background: var(--hover-inverse);
    color: var(--text);
}

/* ── Адаптивность ── */
@media (max-width: 900px) {
    .nav-container {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .nav-left, .nav-right {
        width: 100%;
    }

    .nav-right {
        justify-content: space-between;
    }

    .flash-wrap {
        top: 86px;
    }
}

@media (max-width: 560px) {
    .nav-left {
        gap: 4px;
    }

    .nav-link {
        font-size: var(--text-xs);
        padding: 7px 9px;
    }

    .flash-wrap {
        width: calc(100vw - 14px);
        top: 92px;
    }
}


/* ── Impersonation bar ── */
.impersonate-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 6px 16px;
    background: var(--warning-bg);
    border-bottom: 1px solid var(--warning-border);
    color: var(--warning-text);
    font-size: var(--text-xs);
    font-weight: 500;
    flex-shrink: 0;
}

.impersonate-bar-btn {
    padding: 3px 12px;
    border: 1px solid var(--warning-text);
    border-radius: 6px;
    background: var(--surface);
    color: var(--warning-text);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s ease;
}

.impersonate-bar-btn:hover {
    background: var(--warning-bg);
}

/* past_due / suspended баннер — по аналогии с impersonate-bar, но в error-тонах */
.billing-alert-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 6px 16px;
    background: var(--error-bg);
    border-bottom: 1px solid var(--error-border);
    color: var(--error-text);
    font-size: var(--text-xs);
    font-weight: 500;
    flex-shrink: 0;
}

.billing-alert-bar a {
    padding: 3px 12px;
    border: 1px solid var(--error-text);
    border-radius: 6px;
    background: var(--surface);
    color: var(--error-text);
    font-size: var(--text-xs);
    font-weight: 600;
    text-decoration: none;
    transition: 0.15s ease;
}

.billing-alert-bar a:hover {
    background: var(--error-bg);
}
