/* Klear — Sidebar styles */
.cockpit-sidebar {
    grid-area: sidebar;
    width: var(--sidebar-width);
    background-color: var(--ck-surface);
    border-right: 1px solid var(--ck-hairline);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1045;
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Brand ───────────────────────────────────────────────── */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0 1rem;
    border-bottom: 1px solid var(--ck-hairline);
    text-decoration: none;
    color: var(--ck-text);
    height: var(--topbar-height);
    flex-shrink: 0;
}

.sidebar-brand:hover {
    color: var(--ck-text);
}

.sidebar-brand__icon {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--ck-primary) 0%, #A78BFA 100%);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.72rem;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: -0.03em;
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.35);
}

.sidebar-brand__name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ck-text);
}

.sidebar-brand__env {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ck-muted);
    margin-top: 0.15rem;
}

/* ── Nav sections ────────────────────────────────────────── */
.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section {
    padding: 1rem 1rem 0.25rem;
}

.sidebar-section__label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ck-muted);
    font-weight: 500;
}

/* ── Nav items ───────────────────────────────────────────── */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.42rem 1rem;
    font-size: var(--fs-md);
    color: var(--ck-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: background-color 0.12s, color 0.12s, border-color 0.12s;
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    margin-right: 0.5rem;
    line-height: 1.3;
}

.sidebar-item:hover {
    background-color: rgba(139, 92, 246, 0.07);
    color: var(--ck-body-strong);
    border-left-color: rgba(139, 92, 246, 0.25);
}

.sidebar-item.active {
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--ck-text);
    border-image: linear-gradient(180deg, var(--ck-primary) 0%, rgba(139,92,246,0.15) 100%) 1;
    border-left-style: solid;
    border-left-width: 2px;
    font-weight: 500;
}

.sidebar-item.disabled {
    opacity: 0.38;
    cursor: not-allowed;
    pointer-events: none;
}

.sidebar-item__icon {
    font-size: 0.875rem;
    flex-shrink: 0;
    width: 1rem;
    text-align: center;
}

.sidebar-item__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* "Coming soon" badge — amber, not primary */
.sidebar-item__badge {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    padding: 0.1em 0.4em;
    border-radius: var(--r-xs);
    background-color: rgba(244, 183, 64, 0.12);
    color: var(--ck-amber);
    border: 1px solid rgba(244, 183, 64, 0.25);
    font-weight: 500;
    flex-shrink: 0;
}

/* ── Sidebar footer ──────────────────────────────────────── */
.sidebar-footer {
    border-top: 1px solid var(--ck-hairline);
    padding: 0.75rem 1rem;
    flex-shrink: 0;
}

.sidebar-footer__status {
    font-family: var(--font-mono);
    font-size: var(--fs-xxs);
    color: var(--ck-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sidebar-footer__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--status-pass);
    flex-shrink: 0;
    animation: dot-pulse 2.5s ease-in-out infinite;
}

.sidebar-footer__dot--warn {
    background-color: var(--status-warn);
}

.sidebar-footer__user {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--ck-muted);
    margin-bottom: 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer__logout {
    display: flex;
    width: 100%;
}

.sidebar-footer__logout form {
    width: 100%;
}

.sidebar-footer__logout .btn {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    padding: 0.28rem 0.6rem;
    width: 100%;
    color: var(--ck-muted);
    border-color: var(--ck-hairline);
    text-align: left;
    border-radius: var(--r-sm);
    letter-spacing: 0.02em;
}

.sidebar-footer__logout .btn:hover {
    color: #FF7070;
    background-color: rgba(255, 92, 92, 0.08);
    border-color: rgba(255, 92, 92, 0.3);
}

/* ── Sidebar internal collapse button ────────────────────── */
.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: none;
    border-top: 1px solid var(--ck-hairline);
    color: var(--ck-muted-soft);
    cursor: pointer;
    transition: color 0.12s, background-color 0.12s;
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background-color: var(--ck-surface-2);
    color: var(--ck-text);
}

.sidebar-collapse-btn__icon {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

/* ── Desktop collapsed (mini-rail) ───────────────────────── */
.cockpit-shell.sidebar-collapsed .cockpit-sidebar {
    width: var(--sidebar-width-collapsed);
}

.cockpit-shell.sidebar-collapsed .sidebar-brand__name,
.cockpit-shell.sidebar-collapsed .sidebar-brand__env,
.cockpit-shell.sidebar-collapsed .sidebar-section__label,
.cockpit-shell.sidebar-collapsed .sidebar-item__label,
.cockpit-shell.sidebar-collapsed .sidebar-item__badge,
.cockpit-shell.sidebar-collapsed .sidebar-footer__user,
.cockpit-shell.sidebar-collapsed .sidebar-footer__status {
    display: none;
}

.cockpit-shell.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: 0;
}

.cockpit-shell.sidebar-collapsed .sidebar-item {
    justify-content: center;
    padding: 0.5rem 0;
    margin-right: 0;
    border-left-color: transparent;
    border-left-style: solid;
    border-image: none;
    border-radius: var(--r-sm);
}

.cockpit-shell.sidebar-collapsed .sidebar-item.active {
    border-left-color: transparent;
    border-image: none;
    background-color: rgba(139, 92, 246, 0.14);
}

.cockpit-shell.sidebar-collapsed .sidebar-item__icon {
    width: auto;
    font-size: 1.05rem;
}

.cockpit-shell.sidebar-collapsed .sidebar-section {
    padding: 0.5rem 0 0.25rem;
}

.cockpit-shell.sidebar-collapsed .sidebar-collapse-btn {
    justify-content: center;
    padding: 0.4rem 0;
}

.cockpit-shell.sidebar-collapsed .sidebar-collapse-btn__icon {
    transform: rotate(180deg);
}

.cockpit-shell.sidebar-collapsed .sidebar-footer {
    padding: 0.75rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.cockpit-shell.sidebar-collapsed .sidebar-footer__logout {
    width: auto;
}

.cockpit-shell.sidebar-collapsed .sidebar-footer__logout form {
    width: auto;
}

.cockpit-shell.sidebar-collapsed .sidebar-footer__logout .btn {
    width: auto;
    padding: 0.35rem 0.5rem;
    text-align: center;
}

/* ── Mobile: hidden off-canvas by default (≤991px) ──────── */
@media (max-width: 991px) {
    .cockpit-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
        border-right: none;
        box-shadow: none;
    }

    .cockpit-sidebar.show-mobile {
        transform: translateX(0);
        box-shadow: 6px 0 32px rgba(0, 0, 0, 0.6);
    }
}

/* ── Sidebar backdrop (mobile overlay) ───────────────────── */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1044;
    display: none;
    backdrop-filter: blur(2px);
}

.sidebar-backdrop.show {
    display: block;
}
