/* ============================================================
   ibv-sidebar.css  —  Left slide-out navigation
   Design tokens: ibv-tokens.css
   ============================================================ */

/* ── Overlay (backdrop) ────────────────────────────────────── */
.ibv-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 49;
    background: rgba(28, 20, 16, .46);
    backdrop-filter: blur(2px);
}
.ibv-sb-open .ibv-sidebar-overlay {
    display: block;
    animation: ibv-fade-in .18s ease;
}

/* ── Sidebar container ─────────────────────────────────────── */
.ibv-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: 236px;
    display: flex;
    flex-direction: column;
    background: var(--ibv-card);
    border-right: 1px solid var(--ibv-border);
    box-shadow: var(--ibv-shadow);
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}
.ibv-sb-open .ibv-sidebar {
    transform: translateX(0);
}

/* ── Sidebar header ────────────────────────────────────────── */
.ibv-sb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 12px;
    min-height: 64px;
    border-bottom: 1px solid var(--ibv-border);
    flex-shrink: 0;
}
.ibv-sb-head .ibv-brand {
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}
.ibv-sb-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: var(--ibv-radius-sm);
    background: transparent;
    color: var(--ibv-muted);
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
    transition: background .14s, color .14s;
}
.ibv-sb-close:hover {
    background: var(--ibv-danger-soft);
    color: var(--ibv-danger);
}

/* ── Nav scroll area ───────────────────────────────────────── */
.ibv-sb-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0 16px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.ibv-sb-nav::-webkit-scrollbar { width: 4px; }
.ibv-sb-nav::-webkit-scrollbar-thumb { background: var(--ibv-border-strong); border-radius: 2px; }

/* ── Nav item (top level) ──────────────────────────────────── */
.ibv-sb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 14px;
    border: none;
    border-left: 3px solid transparent;
    background: transparent;
    color: var(--ibv-muted);
    font-family: var(--ibv-font-sans);
    font-size: .84rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background .13s, color .13s, border-color .13s;
    border-radius: 0 var(--ibv-radius-sm) var(--ibv-radius-sm) 0;
    margin-right: 8px;
    text-decoration: none;
}
.ibv-sb-item:hover {
    background: var(--ibv-accent-soft);
    color: var(--ibv-ink);
    border-left-color: color-mix(in srgb, var(--ibv-accent) 40%, transparent);
}
.ibv-sb-item.ibv-sb-active {
    background: var(--ibv-accent-soft);
    color: var(--ibv-accent);
    border-left-color: var(--ibv-accent);
    font-weight: 600;
}
.ibv-sb-item.ibv-sb-active .ibv-sb-icon {
    color: var(--ibv-accent);
}

/* ── Icons ─────────────────────────────────────────────────── */
.ibv-sb-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    color: var(--ibv-muted);
    transition: color .13s;
}
.ibv-sb-item:hover .ibv-sb-icon,
.ibv-sb-item.ibv-sb-active .ibv-sb-icon {
    color: var(--ibv-accent);
}

/* ── Expand chevron ────────────────────────────────────────── */
.ibv-sb-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-left: auto;
    color: var(--ibv-muted);
    transition: transform .18s ease, color .13s;
}
.ibv-sb-group.ibv-sb-expanded > .ibv-sb-item .ibv-sb-chevron {
    transform: rotate(90deg);
    color: var(--ibv-accent);
}

/* ── Group container ───────────────────────────────────────── */
.ibv-sb-group {
    display: flex;
    flex-direction: column;
}

/* ── Sub-items ─────────────────────────────────────────────── */
.ibv-sb-sub {
    display: none;
    flex-direction: column;
    gap: 1px;
    padding: 2px 0 4px 30px;
}
.ibv-sb-group.ibv-sb-expanded > .ibv-sb-sub {
    display: flex;
    animation: ibv-sb-reveal .16s ease;
}
.ibv-sb-sub-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 12px;
    border: none;
    border-left: 2px solid transparent;
    background: transparent;
    color: var(--ibv-muted);
    font-family: var(--ibv-font-sans);
    font-size: .8rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    border-radius: 0 var(--ibv-radius-sm) var(--ibv-radius-sm) 0;
    margin-right: 8px;
    transition: background .13s, color .13s, border-color .13s;
}
.ibv-sb-sub-item:hover {
    background: var(--ibv-accent-soft);
    color: var(--ibv-ink);
    border-left-color: color-mix(in srgb, var(--ibv-accent) 30%, transparent);
}
.ibv-sb-sub-item.ibv-sb-active {
    color: var(--ibv-accent);
    border-left-color: var(--ibv-accent);
    font-weight: 600;
}
.ibv-sb-sub-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--ibv-muted);
    transition: color .13s;
}
.ibv-sb-sub-item:hover .ibv-sb-sub-icon,
.ibv-sb-sub-item.ibv-sb-active .ibv-sb-sub-icon {
    color: var(--ibv-accent);
}

/* ── Badge (e.g. history unread count) ────────────────────── */
.ibv-sb-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--ibv-accent);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    margin-left: auto;
    line-height: 1;
}

/* ── Divider ───────────────────────────────────────────────── */
.ibv-sb-divider {
    height: 1px;
    background: var(--ibv-border);
    margin: 8px 14px;
}

/* ── Language select ───────────────────────────────────────── */
.ibv-sb-lang-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    color: var(--ibv-muted);
    font-size: .84rem;
}
.ibv-sb-lang {
    flex: 1;
    border: 1px solid var(--ibv-border);
    border-radius: var(--ibv-radius-sm);
    background: var(--ibv-bg);
    color: var(--ibv-text);
    font-family: var(--ibv-font-sans);
    font-size: .8rem;
    padding: 3px 6px;
    cursor: pointer;
}

/* ── Footer area ───────────────────────────────────────────── */
.ibv-sb-footer {
    border-top: 1px solid var(--ibv-border);
    padding: 8px 0 10px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* ── Section label (inside nav) ────────────────────────────── */
.ibv-sb-section-label {
    padding: 12px 14px 4px;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ibv-muted);
    opacity: .7;
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes ibv-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes ibv-sb-reveal {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}
