/* ═══════════════════════════════════════════════════════════════════════════
   BOTTLENECK — App-shell tipo editor (Blender / Unity)
   Menú lateral plegable + topbar + statusbar envolviendo el calculador.
   Reutiliza las variables --bx-* definidas en bottleneck-hud.css (.bnx).
   No toca el interior del calculador (.bn-container) ni el motor.
═══════════════════════════════════════════════════════════════════════════ */

.bnx {
    /* ── Paleta neutra basada en rgb(18,18,18) ── */
    --bx-bg:      #121212;   /* rgb(18,18,18) — fondo base */
    --bx-bg-2:    #171717;   /* superficie ligeramente elevada */
    --bx-surface: #1a1a1a;
    --bx-card:    #1e1e1e;

    --bns-nav-h: 88px;   /* alto del navbar fijo (lo ajusta el JS) */
    --bns-w: 256px;      /* ancho del menú lateral */
    --bns-top-h: 46px;   /* alto de la barra superior del shell */
    padding-top: var(--bns-nav-h);
}

/* ── Rejilla principal: menú + escenario ─────────────────────────────────── */
.bns {
    display: grid;
    grid-template-columns: var(--bns-w) minmax(0, 1fr);
    align-items: start;
    position: relative;
    transition: grid-template-columns 0.22s ease;
}

/* ═══════════════════ MENÚ LATERAL ═══════════════════ */
.bns-side {
    position: sticky;
    top: var(--bns-nav-h);
    align-self: start;
    height: calc(100vh - var(--bns-nav-h));
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--bx-surface), var(--bx-bg-2));
    border-right: 1px solid var(--bx-border);
    z-index: 20;
}

/* botón de plegar/desplegar — pegado al BORDE DERECHO del menú */
.bns-collapse {
    position: absolute;
    top: 50%; right: -13px; z-index: 31;
    transform: translateY(-50%);
    width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--bx-card);
    border: 1px solid var(--bx-border);
    color: var(--bx-dim); cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
    transition: color 0.18s, border-color 0.18s, transform 0.18s;
}
.bns-collapse:hover { color: var(--bx-accent); border-color: var(--bx-border-2); }
.bns-collapse i { font-size: 0.78rem; }

/* cabecera del menú */
.bns-side-head {
    display: flex; align-items: center; gap: 11px;
    padding: 16px 16px 14px; border-bottom: 1px solid var(--bx-border);
    flex-shrink: 0;
}
.bns-logo {
    width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,123,58,0.12); color: var(--bx-accent);
    border: 1px solid var(--bx-border-2); font-size: 0.95rem;
}
.bns-side-title { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.bns-side-title strong { font-size: 0.92rem; color: var(--bx-text); font-weight: 800; letter-spacing: 0.2px; }
.bns-side-title span { font-size: 0.64rem; color: var(--bx-mut); font-family: var(--bx-mono); letter-spacing: 0.05em; }

/* zona scrolleable con la navegación */
.bns-side-inner { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.bns-side-inner::-webkit-scrollbar { width: 7px; }
.bns-side-inner::-webkit-scrollbar-thumb { background: var(--bx-border); border-radius: 4px; }

.bns-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 14px; }
.bns-nav-label {
    font-family: var(--bx-mono); font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.18em; color: var(--bx-mut);
    padding: 13px 10px 5px; white-space: nowrap;
}
.bns-nav-item {
    position: relative; display: flex; align-items: center; gap: 11px;
    width: 100%; padding: 9px 11px; border-radius: 8px;
    background: none; border: none; cursor: pointer; text-align: left;
    color: var(--bx-dim); font-size: 0.85rem; font-weight: 600;
    font-family: inherit; text-decoration: none; white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.bns-nav-item i { width: 18px; text-align: center; font-size: 0.92rem; color: var(--bx-mut); transition: color 0.15s; flex-shrink: 0; }
.bns-nav-item:hover { background: rgba(255,255,255,0.045); color: var(--bx-text); }
.bns-nav-item:hover i { color: var(--bx-dim); }
.bns-nav-item.is-active { background: rgba(255,123,58,0.1); color: var(--bx-accent); }
.bns-nav-item.is-active i { color: var(--bx-accent); }
.bns-nav-item.is-active::before {
    content: ''; position: absolute; left: 0; top: 7px; bottom: 7px;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--bx-accent);
}
.bns-nav-dot {
    width: 7px; height: 7px; border-radius: 50%; margin-left: auto;
    background: #27c93f; box-shadow: 0 0 8px rgba(39,201,63,0.6);
}

/* pie del menú: estadísticas (cuentan con .bnx-count) */
.bns-side-foot {
    display: flex; gap: 8px; padding: 12px;
    border-top: 1px solid var(--bx-border); flex-shrink: 0;
}
.bns-stat {
    flex: 1; min-width: 0; text-align: center; padding: 8px 4px;
    background: rgba(255,255,255,0.025); border: 1px solid var(--bx-border);
    border-radius: 9px;
}
.bns-stat strong {
    display: block; font-family: var(--bx-mono); font-size: 1.05rem;
    color: var(--bx-text); font-variant-numeric: tabular-nums; line-height: 1;
}
.bns-stat span { font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--bx-mut); }

/* ── Estado plegado: solo iconos ── */
.bns.is-collapsed { --bns-w: 66px; }
.bns.is-collapsed .bns-side-title,
.bns.is-collapsed .bns-nav-item span,
.bns.is-collapsed .bns-nav-label,
.bns.is-collapsed .bns-nav-dot,
.bns.is-collapsed .bns-stat span { display: none; }
.bns.is-collapsed .bns-side-head { justify-content: center; padding-left: 0; padding-right: 0; }
.bns.is-collapsed .bns-nav-item { justify-content: center; padding: 10px 0; gap: 0; }
.bns.is-collapsed .bns-nav-label { padding: 10px 0 4px; text-align: center; }
.bns.is-collapsed .bns-side-foot { flex-direction: column; }
.bns.is-collapsed .bns-stat strong { font-size: 0.9rem; }

/* ═══════════════════ ESCENARIO ═══════════════════ */
.bns-stage {
    min-width: 0; display: flex; flex-direction: column;
    min-height: calc(100vh - var(--bns-nav-h));
}

/* barra superior (sticky bajo el navbar) */
.bns-top {
    position: sticky; top: var(--bns-nav-h); z-index: 15;
    display: flex; align-items: center; gap: 12px;
    height: var(--bns-top-h); padding: 0 16px;
    background: rgba(18,18,18,0.86); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--bx-border);
    font-family: var(--bx-mono);
}
.bns-side-show {
    display: none; background: none; border: none; color: var(--bx-dim);
    cursor: pointer; font-size: 1rem; padding: 4px;
}
.bns-bread { font-size: 0.8rem; color: var(--bx-dim); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bns-bread i { color: var(--bx-accent); }
.bns-bread-sep { color: var(--bx-mut); }
#bns-bread-sec { color: var(--bx-text); }
.bns-top-spacer { flex: 1; }
.bns-top-res, .bns-top-status { font-size: 0.72rem; color: var(--bx-mut); display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.bns-top-res i { color: var(--bx-accent); }
.bns-top-status i { font-size: 0.5rem; color: #27c93f; animation: bnxPulse 2s ease-in-out infinite; }

/* vista (contiene la consola + secciones; usa scroll de ventana) */
.bns-view { flex: 1; min-width: 0; }
.bns-view > section { scroll-margin-top: calc(var(--bns-nav-h) + var(--bns-top-h) + 12px); }
.bns-view .bnx-console { margin-top: 0; padding-top: 22px; }
.bns-view .bnx-frame { max-width: 1180px; }
.bns-view .bnx-section { max-width: 1180px; }

/* barra de estado inferior */
.bns-status {
    display: flex; align-items: center; gap: 16px;
    height: 30px; padding: 0 16px; flex-shrink: 0;
    border-top: 1px solid var(--bx-border);
    background: rgba(0,0,0,0.25);
    font-family: var(--bx-mono); font-size: 0.7rem; color: var(--bx-mut);
}
.bns-status i { color: var(--bx-dim); margin-right: 5px; }
.bns-status-spacer { flex: 1; }

/* El footer arranca pegado al shell: elimina la franja de 48px donde
   asomaba el patrón diagonal del body (margin-top global de .site-footer). */
.bnx + .site-footer { margin-top: 0; }

/* backdrop para el menú en móvil */
.bns-backdrop { display: none; }

/* ═══════════════════ RESPONSIVE ═══════════════════ */
@media (max-width: 900px) {
    .bns { grid-template-columns: minmax(0, 1fr); }
    .bns-side {
        position: fixed; top: var(--bns-nav-h); left: 0; bottom: 0;
        width: 272px; height: auto;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 12px 0 40px rgba(0,0,0,0.5);
    }
    .bns.side-open .bns-side { transform: translateX(0); }
    .bns-collapse { display: none; }
    .bns-side-show { display: inline-flex; }
    .bns-backdrop {
        display: block; position: fixed; inset: 0; z-index: 55;
        background: rgba(0,0,0,0.55); opacity: 0; pointer-events: none;
        transition: opacity 0.22s ease;
    }
    .bns.side-open .bns-backdrop { opacity: 1; pointer-events: auto; }
}

/* ═══════════════════ TEMA CLARO ═══════════════════ */
.light-theme .bns-top { background: rgba(255,255,255,0.85); }
.light-theme .bns-status { background: rgba(0,0,0,0.03); }
.light-theme .bns-collapse { box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.light-theme .bns-side-show { color: var(--bx-dim); }
