/*
 * The sidebar menu (plan-menu, phase 10), for the users who choose it: the AxisPOS desktop's
 * «Barra lateral», which replaced the ribbon there and here. Sections with their screens on the
 * left, folding to a column of icons, and a header bar with the path, the search and the
 * notifications. `_Sidebar.cshtml` draws it, `sidebar.js` folds it.
 *
 * The only desktop menu: it replaced the ribbon and the rail. From 769 px up — on a tablet it folds
 * to its icons by itself (under 1200 px, `sidebar.js`); under that the phone bar of
 * `mobile-menu.css` rules. The rail's markup is still in the page, always hidden: it holds the
 * search, theme and section-panel logic the sidebar presses.
 *
 * The frame is a grid: the bar spans both rows, the header bar takes the first row of the second
 * column and the page the second. `display: grid !important` beats the inline `display: flex` and
 * Bootstrap's `d-flex` on the container.
 */
.axis-sidebar,
.axis-topbar,
.axis-sb-fly {
    display: none;
}

@media (min-width: 769px) {
    /* The id as well: site.css gives `#app-container` `height: auto !important` up to 1024 px,
       for the rail's old horizontal strip, and the frame has to stay the window's height. */
    #app-container.menu-sidebar {
        height: 100vh !important;
    }

    .app-container.menu-sidebar {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
    }

    .app-container.menu-sidebar > .primary-sidebar,
    .app-container.menu-sidebar .secondary-sidebar,
    .app-container.menu-sidebar #path-header {
        display: none !important;
    }

    .app-container.menu-sidebar > .axis-sidebar {
        display: flex;
        grid-column: 1;
        grid-row: 1 / span 2;
    }

    .app-container.menu-sidebar > .axis-topbar {
        display: flex;
        grid-column: 2;
        grid-row: 1;
    }

    .app-container.menu-sidebar > .main-content {
        grid-column: 2;
        grid-row: 2;
        height: auto !important;
        min-height: 0;
        overflow-y: auto;
    }

    .app-container.menu-sidebar > .axis-sb-fly:not([hidden]) {
        display: block;
    }

    /* The bell lives in the header bar: the floating one would say the same thing twice. */
    .app-container.menu-sidebar ~ .axis-bubble-notifications {
        display: none;
    }
}

body.kiosk-page .axis-sidebar,
body.kiosk-page .axis-topbar {
    display: none !important;
}

.axis-sidebar {
    flex-direction: column;
    width: 248px;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    transition: width .18s ease;
    overflow: hidden;
    z-index: 1000;
}

.axis-sb-brand {
    flex: none;
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
}

.axis-sb-brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
}

.axis-sb-brand img {
    width: 30px;
    height: 24px;
    flex: none;
}

.axis-sb-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 8px 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.axis-sb-item,
.axis-sb-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--fg);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.axis-sb-item:hover,
.axis-sb-head:hover,
.axis-sb-head.is-flying {
    background: var(--accent-subtle);
    color: var(--fg);
}

.axis-sb-item:focus-visible,
.axis-sb-head:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.axis-sb-item.is-current {
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 600;
}

.axis-sb-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Section and footer icons are inline SVGs — the rail's own drawings — painted in the text's colour. */
.axis-sb-sico {
    flex: none;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.axis-sb-sico svg {
    width: 20px;
    height: 20px;
}

.axis-sb-sico svg [fill]:not([fill="none"]),
.axis-sb-sico svg[fill]:not([fill="none"]) {
    fill: currentColor;
}

.axis-sb-sico svg [stroke]:not([stroke="none"]) {
    stroke: currentColor;
}

/* Entry icons are the menu's SVG files, used as a mask so they take the theme's colour. */
.axis-sb-ico {
    flex: none;
    width: 18px;
    height: 18px;
    background-color: currentColor;
    opacity: .85;
    -webkit-mask: var(--ico) center / contain no-repeat;
    mask: var(--ico) center / contain no-repeat;
}

.axis-sb-home {
    margin-bottom: 4px;
}

.axis-sb-section {
    margin-top: 2px;
}

.axis-sb-head {
    font-weight: 600;
}

.axis-sb-section.has-current > .axis-sb-head {
    color: var(--accent);
}

.axis-sb-chevron {
    flex: none;
    width: 14px;
    height: 14px;
    color: var(--fg-subtle);
    transition: transform .15s ease;
}

.axis-sb-section.is-open > .axis-sb-head .axis-sb-chevron {
    transform: rotate(90deg);
}

.axis-sb-body {
    display: none;
    padding: 2px 0 6px 8px;
    margin-left: 19px;
    border-left: 1px solid var(--border);
}

.axis-sb-section.is-open > .axis-sb-body {
    display: block;
}

.axis-sb-body .axis-sb-item {
    min-height: 32px;
    padding-left: 8px;
}

.axis-sb-group {
    padding: 10px 8px 3px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--fg-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.axis-sb-discover .axis-sb-sico {
    color: var(--novedad);
}

.axis-sb-foot {
    flex: none;
    padding: 8px;
    border-top: 1px solid var(--border);
}

.axis-sb-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px 2px 6px;
    margin-top: 4px;
}

.axis-sb-avatar {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 700;
    font-size: 12px;
}

.axis-sb-user-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--fg);
}

.axis-sb-logout {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--fg-muted);
}

.axis-sb-logout:hover {
    background: var(--danger-subtle);
    color: var(--danger);
}

.axis-sb-logout svg {
    width: 18px;
    height: 18px;
}

/* Collapsed: a column of icons. Labels, chevrons and the open sections' bodies go; a section opens
   as the flyout beside the bar instead. */
.axis-sidebar.is-collapsed {
    width: 64px;
}

.axis-sidebar.is-collapsed .axis-sb-label,
.axis-sidebar.is-collapsed .axis-sb-chevron,
.axis-sidebar.is-collapsed .axis-sb-body,
.axis-sidebar.is-collapsed .axis-sb-user-name {
    display: none !important;
}

.axis-sidebar.is-collapsed .axis-sb-brand {
    padding: 0;
    justify-content: center;
}

.axis-sidebar.is-collapsed .axis-sb-item,
.axis-sidebar.is-collapsed .axis-sb-head {
    justify-content: center;
    padding: 0;
    min-height: 40px;
}

.axis-sidebar.is-collapsed .axis-sb-section.has-current > .axis-sb-head {
    background: var(--accent-subtle);
}

.axis-sidebar.is-collapsed .axis-sb-user {
    flex-direction: column;
    padding: 6px 0 0;
    gap: 6px;
}

.axis-sb-fly {
    position: fixed;
    z-index: 1003;
    width: 260px;
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}

.axis-sb-fly-title {
    padding: 6px 10px;
    font-weight: 700;
    font-size: 14px;
    color: var(--fg);
}

/* The header bar. */
.axis-topbar {
    position: relative;
    z-index: 20;
    align-items: center;
    gap: 12px;
    height: 52px;
    padding: 0 16px 0 10px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

/* Two classes: `_Layout.cshtml.css` paints every scoped `a` white (`a[b-…]`), the bell included. */
.axis-topbar .axis-topbar-btn {
    position: relative;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--fg);
    cursor: pointer;
}

.axis-topbar .axis-topbar-btn:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}

.axis-topbar-btn svg {
    width: 20px;
    height: 20px;
}

.axis-crumb {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--fg-muted);
    white-space: nowrap;
    overflow: hidden;
}

.axis-crumb b {
    color: var(--fg);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.axis-crumb-sep {
    color: var(--fg-subtle);
}

.axis-topbar-search {
    flex: 0 1 380px;
    min-width: 180px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--fg-muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.axis-topbar-search:hover {
    border-color: var(--accent-border);
    color: var(--fg);
}

.axis-topbar-search svg {
    flex: none;
    width: 16px;
    height: 16px;
}

.axis-topbar-search span {
    flex: 1 1 auto;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.axis-topbar-search kbd {
    flex: none;
    font: inherit;
    font-size: 11px;
    padding: 1px 6px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface);
    color: var(--fg-muted);
}

.axis-topbar-badge {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
}

.axis-topbar-badge.is-dot {
    min-width: 9px;
    width: 9px;
    height: 9px;
    padding: 0;
    top: 6px;
    right: 6px;
}

@media (prefers-reduced-motion: reduce) {
    .axis-sidebar,
    .axis-sb-chevron {
        transition: none;
    }
}
