/* Limitless layout_2 alignment overrides for NeroRM */

:root {
    /* Fluid chrome dimensions — keep sidebar/topbar proportional at 80–150% browser zoom.
       Use rem so font-size respects user-agent zoom; clamp() ensures minimums on tight
       widths and caps growth on wide displays. See assets/css/app.css scaling-tokens
       comment block for the full system. */
    --nr-sidebar-width: clamp(220px, 16rem, 280px);
    --nr-sidebar-collapsed-width: clamp(48px, 3.5rem, 64px);
    --nr-topbar-height: 3.5rem;        /* was 56px */
    --nr-topbar-bg: #d9cfb2;
}

html,
body {
    color-scheme: light;
    overflow-y: auto !important;
}

body {
    padding-top: var(--nr-topbar-height);
    padding-left: var(--nr-sidebar-width);
}

/* Inner scroll region: scrollbar sits in the content column, not under the fixed chrome */
html.nr-main-scroll-active,
html.nr-main-scroll-active body {
    height: 100%;
    overflow: hidden !important;
}

html.nr-main-scroll-active body {
    padding-top: 0;
    padding-left: 0;
}

html.nr-main-scroll-active .nr-main-scroll {
    position: fixed;
    top: var(--nr-topbar-height);
    left: var(--nr-sidebar-width);
    right: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    /* Trap AG Grid / rich overlay z-index stacks (e.g. 99999 tooltips) below fixed chrome (navbar 1055, sidebar 1060). */
    z-index: 1;
}

html.nr-main-scroll-active body.nr-sidebar-main-resized .nr-main-scroll {
    left: var(--nr-sidebar-collapsed-width);
}

@media (max-width: 767.98px) {
    html.nr-main-scroll-active .nr-main-scroll {
        left: 0;
    }
}

/* Modals must sit above fixed sidebar (1060) / navbar (1055); default BS z-index ties the navbar */
html.nr-main-scroll-active .modal-backdrop {
    z-index: 1085;
}

html.nr-main-scroll-active .modal {
    z-index: 1090;
}

html.nr-main-scroll-active .offcanvas-backdrop {
    z-index: 1085;
}

html.nr-main-scroll-active .offcanvas {
    z-index: 1090;
}

.sidebar.sidebar-main {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--nr-sidebar-width);
    z-index: 1060;
    overflow-y: auto;
    overflow-x: hidden;
    background: #1f2937;
    color: #e5e7eb;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.18);
}

.sidebar.sidebar-main .sidebar-section {
    background: #1f2937;
    color: #e5e7eb;
}

.sidebar.sidebar-main .sidebar-logo,
.sidebar.sidebar-main .sidebar-logo > a,
.sidebar.sidebar-main .nav-item-header,
.sidebar.sidebar-main .nav-link,
.sidebar.sidebar-main .nav-link-btn,
.sidebar.sidebar-main .nav-group-sub .nav-link,
.sidebar.sidebar-main .sidebar-control,
.sidebar.sidebar-main .sidebar-mobile-main-toggle {
    color: #e5e7eb !important;
}

.sidebar.sidebar-main .nav-item-header {
    background: #1f2937;
}

.sidebar.sidebar-main .nav-link:hover,
.sidebar.sidebar-main .nav-link-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff !important;
}

.sidebar.sidebar-main .nav-link.active,
.sidebar.sidebar-main .nav-link-btn.active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff !important;
    font-weight: 600;
}

.sidebar.sidebar-main .nav-group-sub {
    background: #1f2937;
}

.sidebar.sidebar-main .dropdown-divider,
.sidebar.sidebar-main .border-bottom {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

.sidebar.sidebar-main .text-uppercase,
.sidebar.sidebar-main .opacity-50 {
    color: #9ca3af !important;
    opacity: 1 !important;
}

.sidebar.sidebar-main .btn-flat-white {
    color: #fff !important;
}

.sidebar .nav-link-btn {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar .nav-link-btn span {
    flex-grow: 1;
}

.sidebar .nav-group-sub .nav-item {
    margin: 0;
}

.sidebar .nav-group-sub .nav-link {
    padding-top: 0.42rem;
    padding-bottom: 0.42rem;
}

.sidebar .nav-link > i,
.sidebar .nav-link-btn > i {
    font-size: 1.08rem;
    min-width: 1.25rem;
    line-height: 1;
}

.sidebar .dropdown-divider {
    margin: 0.35rem 1rem;
}

.sidebar .sidebar-logo {
    min-height: var(--nr-topbar-height);
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.sidebar .sidebar-logo > a {
    min-height: calc(var(--nr-topbar-height) - 0.7rem);
}

.sidebar .sidebar-logo > a > i {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.navbar.nr-topbar-beige {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: var(--nr-topbar-height);
    background: var(--nr-topbar-bg) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    border-left: 0;
    z-index: 1055;
}

.navbar.nr-topbar-beige .container-fluid {
    padding-left: calc(var(--nr-sidebar-width) + 0.75rem);
}

.nr-topbar-beige .nav-link {
    color: #363226 !important;
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    line-height: 1;
}

.nr-topbar-beige .nav-link > i.bi {
    font-size: 1.02rem;
    line-height: 1;
}

.nr-topbar-beige .nav-link:hover,
.nr-topbar-beige .nav-link:focus {
    background: #e5e7eb !important;
    color: #363226 !important;
}

.nr-topbar-beige .nav-link.active,
.nr-topbar-beige .show > .nav-link {
    background: #e5e7eb !important;
    color: #363226 !important;
}

.nr-topbar-beige .dropdown-toggle::after {
    display: none;
}

.nr-topbar-beige .nr-topbar-caret {
    color: #6b624f;
    font-size: 0.78rem;
    line-height: 1;
}

.nr-topbar-beige .nr-manuals-topbar-link {
    min-height: 2.25rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid rgba(146, 97, 18, 0.35);
    border-radius: 999px;
    background: linear-gradient(135deg, #fff7df 0%, #f4c95d 100%) !important;
    color: #3b2a08 !important;
    box-shadow: 0 0.35rem 0.9rem rgba(146, 97, 18, 0.2);
    font-weight: 700;
}

.nr-topbar-beige .nr-manuals-topbar-link > i.bi {
    color: #8a5a00;
    font-size: 1.12rem;
}

.nr-topbar-beige .nr-manuals-topbar-link .nr-topbar-caret {
    color: #6f4700;
}

.nr-topbar-beige .nr-manuals-topbar-link:hover,
.nr-topbar-beige .nr-manuals-topbar-link:focus,
.nr-topbar-beige .show > .nr-manuals-topbar-link {
    background: linear-gradient(135deg, #fff3c4 0%, #e9ac28 100%) !important;
    color: #261900 !important;
    border-color: rgba(111, 71, 0, 0.5);
    box-shadow: 0 0.45rem 1rem rgba(146, 97, 18, 0.3);
}

.nr-manuals-load-hint {
    position: fixed;
    z-index: 1115;
    white-space: nowrap;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    box-shadow: 0 0.6rem 1.4rem rgba(15, 23, 42, 0.3);
    font-size: 0.82rem;
    font-weight: 700;
    pointer-events: none;
    animation: nrManualsHintFloat 1.05s ease-in-out infinite;
}

.nr-manuals-load-hint::before {
    content: "";
    position: absolute;
    top: -0.45rem;
    left: 50%;
    width: 0.75rem;
    height: 0.75rem;
    background: #111827;
    transform: translateX(-50%) rotate(45deg);
}

.nr-manuals-load-hint-arrow,
.nr-manuals-load-hint-text {
    position: relative;
    z-index: 1;
}

.nr-manuals-load-hint-arrow {
    color: #f4c95d;
    font-size: 1rem;
    line-height: 1;
}

.nr-manuals-load-hint-hide {
    opacity: 0;
    transition: opacity 0.35s ease;
}

@keyframes nrManualsHintFloat {
    0%, 100% { margin-top: 0; }
    50% { margin-top: 0.45rem; }
}

.nr-manuals-dropdown {
    max-width: min(420px, 92vw);
    max-height: min(76vh, 680px);
    overflow-y: auto;
    overflow-x: hidden;
}

.nr-manuals-search-wrap {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    border-bottom: 1px solid #eceff3;
    padding: 0.5rem 0.75rem;
}

.nr-manuals-search-input {
    font-size: 0.92rem;
}

.nr-manuals-search-empty {
    padding: 0.6rem 0.95rem;
    color: #6b7280;
    font-size: 0.88rem;
}

.nr-manual-dropdown-item {
    white-space: normal;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.nr-manual-dropdown-item:hover,
.nr-manual-dropdown-item:focus {
    background: #f6f0dd;
}

.nr-manual-dropdown-item--featured {
    background: linear-gradient(135deg, #fff9e8 0%, #fff3c4 100%);
    border-left: 3px solid #c58c00;
    margin: 0.15rem 0.45rem;
    border-radius: 0.55rem;
    padding-left: 0.85rem;
}

.nr-manual-dropdown-item--featured:hover,
.nr-manual-dropdown-item--featured:focus {
    background: linear-gradient(135deg, #fff3c4 0%, #f4c95d 100%);
}

.nr-manual-featured-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #1f2937;
    color: #f4c95d;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.3;
}

.nr-topbar-beige .nr-manuals-topbar-link.nr-manuals-topbar-link--announce {
    animation: nrManualsTopbarPulse 1.1s ease-in-out 4;
}

@keyframes nrManualsTopbarPulse {
    0%, 100% { box-shadow: 0 0.35rem 0.9rem rgba(146, 97, 18, 0.2); }
    50% { box-shadow: 0 0 0 0.2rem rgba(244, 201, 93, 0.95), 0 0.45rem 1rem rgba(146, 97, 18, 0.35); }
}

.nr-manual-content {
    font-size: 0.98rem;
    line-height: 1.6;
}

.nr-manual-content h2,
.nr-manual-content h3,
.nr-manual-content h4 {
    margin-top: 1.25rem;
    margin-bottom: 0.65rem;
}

.nr-manual-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 0.5rem 1rem rgba(15, 23, 42, 0.08);
    margin: 0.75rem 0;
}

.nr-manual-content table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
}

.nr-manual-content th,
.nr-manual-content td {
    border: 1px solid #dee2e6;
    padding: 0.5rem;
    vertical-align: top;
}

.nr-topbar-beige .navbar-nav {
    align-items: center;
}

.nr-topbar-beige .nav-item {
    display: flex;
    align-items: center;
}

.nr-topbar-brand {
    min-height: 2rem;
}

.nr-topbar-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.nr-topbar-logo {
    height: 35px;
    width: auto;
    display: block;
}

/* Shared in-page side panel styling aligned to the main CRM chrome. */
.nr-sidepanel {
    background: #fff;
    color: #212529;
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.nr-sidepanel .text-muted,
.nr-sidepanel small {
    color: #6c757d !important;
}

.nr-sidepanel .nav-link,
.nr-sidepanel .btn-link,
.nr-sidepanel .nr-sidepanel-link {
    color: #212529;
    border-radius: 0.5rem;
}

.nr-sidepanel .nav-link:hover,
.nr-sidepanel .btn-link:hover,
.nr-sidepanel .nr-sidepanel-link:hover {
    background: #f8f9fa;
    color: #0d6efd;
}

.nr-sidepanel .nav-link.active,
.nr-sidepanel .nr-sidepanel-link.active {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
    font-weight: 600;
}

.nr-sidepanel .form-control,
.nr-sidepanel .form-select {
    background: #fff;
    color: #212529;
    border-color: #ced4da;
}

.nr-sidepanel .form-control::placeholder {
    color: #6c757d;
}

.nr-sidepanel .form-control:focus,
.nr-sidepanel .form-select:focus {
    background: #fff;
    color: #212529;
    border-color: rgba(13, 110, 253, 0.4);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.1);
}

.badge-notification {
    position: absolute;
    top: 0.15rem;
    right: 0.15rem;
    transform: translate(50%, -50%);
    font-size: 0.65rem;
}

/* Anchor header badges to their control only — avoids the bell count visually sitting on “Service Portal”. */
.nr-topbar-beige #notificationsDropdown .nav-link {
    position: relative;
}
.nr-topbar-beige #notificationsDropdown .badge-notification {
    top: 0.05rem;
    right: -0.05rem;
    transform: translate(25%, -40%);
}

/* Topbar dropdowns (Service Portal, Portals, User, bell): inside clicks stay in-panel; Popper gap via data-bs-offset */
.nr-topbar-beige > .container-fluid .navbar-nav.flex-row > li.nav-item.dropdown > ul.dropdown-menu {
    pointer-events: auto;
}

/* Bell dropdown: only the Service Portal issue list scrolls (not the whole menu) */
#notificationsDropdownMenu.dropdown-menu {
    max-height: none;
    overflow: visible;
    pointer-events: auto;
}

#notificationsDropdownMenu #notificationsList.nr-service-portal-notif-scroll,
#notificationsDropdownMenu #orderNotificationsList.nr-order-notif-scroll {
    max-height: min(40vh, 280px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Flex rows can stretch checkbox inputs; size slightly above default for easier clicks */
#notificationsDropdownMenu .notification-cb {
    flex: 0 0 auto;
    align-self: flex-start;
    width: 1.35rem;
    height: 1.35rem;
    min-width: 1.35rem;
    min-height: 1.35rem;
    aspect-ratio: 1;
}

.nav-item {
    position: relative;
}

body.nr-sidebar-main-resized {
    padding-left: var(--nr-sidebar-collapsed-width);
}

.sidebar.sidebar-main.sidebar-main-resized:not(.sidebar-main-unfold) {
    width: var(--nr-sidebar-collapsed-width);
    z-index: 1070;
}

.sidebar.sidebar-main.sidebar-main-resized:not(.sidebar-main-unfold) .sidebar-logo {
    justify-content: center !important;
}

.sidebar.sidebar-main.sidebar-main-resized:not(.sidebar-main-unfold) .sidebar-logo > a {
    width: 100%;
    justify-content: center;
}

.sidebar.sidebar-main.sidebar-main-resized:not(.sidebar-main-unfold) .sidebar-logo > a > i {
    margin: 0 !important;
}

.sidebar.sidebar-main.sidebar-main-resized:not(.sidebar-main-unfold) .sidebar-logo .sidebar-resize-hide,
.sidebar.sidebar-main.sidebar-main-resized:not(.sidebar-main-unfold) .nav-link span,
.sidebar.sidebar-main.sidebar-main-resized:not(.sidebar-main-unfold) .nav-item-header .text-uppercase,
.sidebar.sidebar-main.sidebar-main-resized:not(.sidebar-main-unfold) .nav-group-sub {
    display: none !important;
}

.sidebar.sidebar-main.sidebar-main-resized:not(.sidebar-main-unfold) .nav-link {
    justify-content: center;
}

body.nr-sidebar-main-resized .navbar.nr-topbar-beige {
    left: 0;
}

body.nr-sidebar-main-resized .navbar.nr-topbar-beige .container-fluid {
    padding-left: calc(var(--nr-sidebar-collapsed-width) + 0.75rem);
}

.sidebar.sidebar-main.sidebar-main-resized.sidebar-main-unfold {
    z-index: 1070;
}

/* In collapsed mode, show pin toggle only while unfolded (hover) */
.sidebar.sidebar-main.sidebar-main-resized:not(.sidebar-main-unfold) .sidebar-main-resize {
    display: none !important;
}

.sidebar.sidebar-main.sidebar-main-resized.sidebar-main-unfold .sidebar-main-resize {
    display: inline-flex !important;
}

@media (max-width: 767.98px), (max-width: 991.98px) and (pointer: coarse) {
    body {
        padding-left: 0;
    }

    .sidebar.sidebar-main {
        transform: translateX(-100%);
        transition: transform 0.18s ease;
    }

    .sidebar.sidebar-main.sidebar-mobile-expanded {
        transform: translateX(0);
    }

    .navbar.nr-topbar-beige {
        left: 0;
    }

    .navbar.nr-topbar-beige .container-fluid {
        padding-left: var(--bs-gutter-x, 0.75rem);
    }

    body.nr-sidebar-main-resized,
    body.nr-sidebar-main-resized.nr-sidebar-main-unfold {
        padding-left: 0;
    }
}

/* Sidebar open/close toggles (navbar hamburger + in-sidebar close button).
   Visible exactly when the sidebar is an overlay: below 768px (any pointer)
   or below 992px on touch devices. The touch gate keeps the docked desktop
   sidebar at 768-991px during 80-150% browser zoom (fine pointer). */
.nr-chrome-toggle {
    display: none !important;
}

@media (max-width: 767.98px), (max-width: 991.98px) and (pointer: coarse) {
    .nr-chrome-toggle {
        display: inline-flex !important;
    }
}

/* Auto-hide chrome on scroll (phones + tablets). The JS hook in
   assets/js/header.js toggles `nr-chrome-hidden` on <html> when the user
   scrolls down inside #nr-main-scroll (or the window). The hidden-state
   rules are gated to touch + <992px so a zoomed desktop (fine pointer)
   never hides its fixed chrome. */
.navbar.nr-topbar-beige {
    transition: transform 0.22s ease;
}

@media (max-width: 991.98px) and (pointer: coarse) {
    html.nr-chrome-hidden .navbar.nr-topbar-beige {
        transform: translateY(-100%);
    }

    html.nr-main-scroll-active.nr-chrome-hidden .nr-main-scroll {
        top: 0;
        transition: top 0.22s ease;
    }

    html.nr-chrome-hidden body {
        padding-top: 0;
        transition: padding-top 0.22s ease;
    }
}

/* Mobile sidebar overlay backdrop. Created by the JS hook in
   pages/layout/header/scripts.php whenever the sidebar enters the
   `sidebar-mobile-expanded` state. Click anywhere on the backdrop to
   dismiss the sidebar. Sits just below the sidebar (z-index 1060) and
   above the topbar (1055) / statusbar (1050) so it covers the chrome. */
.nr-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1059;
    /* Only show on mobile widths — JS still creates it on desktop edge
       cases (e.g. zoomed devtools), CSS keeps it harmless there. */
    display: none;
}

@media (max-width: 767.98px), (max-width: 991.98px) and (pointer: coarse) {
    .nr-sidebar-backdrop {
        display: block;
    }
}

#issueReportModal .modal-dialog {
    margin-top: 6.5rem;
}

.nr-sidebar-hint {
    --nr-hint-arrow-x: 22px;
    position: fixed;
    top: calc(var(--nr-topbar-height) + 6px);
    left: 78px;
    z-index: 1085;
    max-width: 340px;
    background: #fff8cc;
    border: 1px solid #e7dba2;
    color: #4b4327;
    border-radius: 8px;
    padding: 0.55rem 2rem 0.55rem 0.65rem;
    font-size: 0.78rem;
    line-height: 1.35;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.nr-sidebar-hint::before {
    content: "";
    position: absolute;
    left: var(--nr-hint-arrow-x);
    top: -7px;
    width: 12px;
    height: 12px;
    background: #fff8cc;
    border-top: 1px solid #e7dba2;
    border-left: 1px solid #e7dba2;
    transform: rotate(45deg);
}

.nr-sidebar-hint-close {
    position: absolute;
    top: 2px;
    right: 6px;
    border: 0;
    background: transparent;
    color: #716535;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

@media (max-width: 767.98px), (max-width: 991.98px) and (pointer: coarse) {
    .nr-sidebar-hint {
        display: none;
    }
}
