/**
 * PunchOut session UI restrictions.
 *
 * All rules are gated on body.is-punchout-session, which is added by
 * Punchout2Go\Punchout\Observer\LayoutObserver only when a session is active.
 * This file loads on every page (via the punchout layout handle) but has
 * zero effect when no session is in progress.
 */

/* Catalog navigation and footer — kept visible during PunchOut session (mirrors BCI behaviour) */

/* ── Header account dropdown ──────────────────────────────────────────────── */

/* Hide all non-essential dropdown items during a PunchOut session */
body.is-punchout-session .punchout-hide {
    display: none !important;
}

/* Show the My Products link only during a PunchOut session */
.punchout-show {
    display: none !important;
}
body.is-punchout-session .punchout-show {
    display: block !important;
}

/* ── My Account left navigation ───────────────────────────────────────────── */

/*
 * Two navigation templates exist:
 *   - `my-account/common/navigation.phtml` (data-nav-item, used in some My Account pages)
 *   - `Logiscenter_Customer::dashboard/tabs.phtml` (#dashboard-tabs, used in the Dashboard)
 *
 * Hide all nav items except Dashboard and My Products in both (mirrors BCI behaviour).
 */

/* Template 1 — common navigation (data-nav-item attribute) */
body.is-punchout-session [data-nav-item]:not([data-nav-item="my-products"]):not([data-nav-item="dashboard"]) {
    display: none !important;
}

/* Template 2 — #dashboard-tabs (Logiscenter_Customer) — selected via href */
body.is-punchout-session #dashboard-tabs li:has(a[href*="/sales/order/"]),
body.is-punchout-session #dashboard-tabs li:has(a[href*="/quotes/account/"]),
body.is-punchout-session #dashboard-tabs li:has(a[href*="/wishlist/"]),
body.is-punchout-session #dashboard-tabs li:has(a[href*="/multiplewishlists/"]),
body.is-punchout-session #dashboard-tabs li:has(a[href*="/customer/users/"]),
body.is-punchout-session #dashboard-tabs li:has(a[href$="/customer/account/"]),
body.is-punchout-session #dashboard-tabs li:has(a[href*="/customer/account/edit"]),
/* Hide TrueView regardless of user permissions. The TrueView entry has an
 * inline submenu whose children link to /rma_assetmanagement/* — matching
 * any of those via :has() collapses the entire parent <li> including the
 * submenu wrapper. */
body.is-punchout-session #dashboard-tabs li:has(a[href*="/rma_assetmanagement"]) {
    display: none !important;
}

/* ── Close PunchOut Session button ────────────────────────────────────────── */

/*
 * The button itself uses the theme's native `btn btn-secondary` classes
 * (see punchout_close.phtml) so it matches Levata's button styling. Here we
 * only guarantee the wrapper is visible and the label never wraps.
 */
#po2go-close,
.punchout-close-container {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center;
    white-space: nowrap;
}
