/* RMC compact horizontal layout — desktop, tablet and mobile */
:root {
    --rmc-header-height: 64px;
    --rmc-module-height: 48px;
    --rmc-blue: #01204e;
    --rmc-accent: #2563eb;
    --rmc-border: #e5e7eb;
}

html, body { max-width: 100%; overflow-x: hidden; }
body.horizontal-layout .navbar-header,
body.responsive-rmc-layout .navbar-header {
    margin-left: 0 !important;
    min-height: var(--rmc-header-height) !important;
    height: var(--rmc-header-height);
    padding: 0 20px !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1100;
}
.navbar-header .topbar-menu {
  
    align-items: center;
    gap: 10px;
}
.navbar-header .topbar-menu > .d-flex:first-child { min-width: 0; flex: 1 1 auto; }

/* One reliable logo only */
.navbar-header .logo.rmc-header-logo {
    display: inline-flex !important;
    width: 176px;
    min-width: 176px;
    height: 52px;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
}
.navbar-header .logo.rmc-header-logo img {
    display: block !important;
    max-width: 166px;
    max-height: 46px;
    width: auto;
    height: auto;
    object-fit: contain;
}
.navbar-header #toggle_btn2 { display: none !important; }
.navbar-header #mobile_btn { display: none !important; }

@media (max-width: 991.98px) {
    .navbar-header #mobile_btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        margin-left: 6px;
        border: 1px solid rgba(255,255,255,.28);
        border-radius: 10px;
        color: #fff;
        background: rgba(255,255,255,.08);
        text-decoration: none;
        flex: 0 0 40px;
        z-index: 1080;
    }
    .navbar-header #mobile_btn i { font-size: 22px; line-height: 1; }

    /* Header hamburger opens the menu — hide the orange bar, keep overlay visible */
    body.horizontal-layout .rmc-modulebar {
        position: static !important;
        height: 0 !important;
        min-height: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
        overflow: visible !important;
        transform: none !important;
        will-change: auto !important;
        z-index: 1090 !important;
    }
    body.horizontal-layout .rmc-topbar-inner {
        height: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        transform: none !important;
    }
    body.horizontal-layout .rmc-menu-toggle {
        display: none !important;
    }
    body.horizontal-layout .rmc-nav {
        position: fixed !important;
        top: var(--rmc-header-height, 56px) !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 1095 !important;
        transform: none !important;
    }
}

/* Search */
.navbar-header .header-search {
    width: min(310px, 30vw) !important;
    margin-left: 10px;
}
.navbar-header .header-search .form-control {
    height: 40px !important;
    border-radius: 22px;
    padding-left: 14px;
    padding-right: 42px;
}
.navbar-header #liveSearchResultsPanel {
    width: min(520px, calc(100vw - 40px)) !important;
    left: 0 !important;
}

/* Right action buttons */
.navbar-header .topbar-menu .header-item { height: var(--rmc-header-height) !important; }
.navbar-header .topbar-menu .header-item .topbar-link {
    width: 38px;
    height: 38px;
}
.navbar-header .profile-img { width: 40px !important; height: 40px !important; }

/* Horizontal module bar - removed conflicting sticky rule */
body.horizontal-layout .rmc-topbar-inner {
    max-width: 100%;
    padding: 0 16px !important;
    gap: 3px !important;
}
body.horizontal-layout .rmc-nav-list { gap: 1px !important; }
body.horizontal-layout .rmc-nav-item > a,
body.horizontal-layout .rmc-dropdown-toggle {
    height: 36px !important;
    padding: 0 8px !important;
    gap: 5px !important;
    border-radius: 9px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
}
body.horizontal-layout .rmc-nav-item i { font-size: 17px !important; }

/* Dropdowns: compact and always inside viewport */
body.horizontal-layout .rmc-dropdown-menu {
    top: calc(100% + 7px) !important;
    width: 230px !important;
    max-width: calc(100vw - 28px) !important;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    border-radius: 12px !important;
}
body.horizontal-layout .rmc-dropdown-wide {
    width: 620px !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;
    padding: 10px !important;
}
body.horizontal-layout .rmc-dropdown-menu > a,
body.horizontal-layout .rmc-menu-group > a {
    min-height: 34px !important;
    padding: 7px 9px !important;
    font-size: 12px !important;
}
/* Keep last menus inside right edge */
body.horizontal-layout .rmc-nav-item:nth-last-child(-n+4) > .rmc-dropdown-menu {
    left: auto !important;
    right: 0 !important;
}

/* Full-width content */
body.horizontal-layout .page-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    min-width: 0;
}
body.horizontal-layout .page-wrapper .content {
    width: 100%;
    min-width: 0;
    padding: 20px 24px;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-responsive > .table { min-width: 900px; margin-bottom: 0; }

/* Tablet and smaller: use module hamburger */
@media (max-width: 1279.98px) {
    :root { --rmc-header-height: 60px; --rmc-module-height: 52px; }
    .navbar-header { padding: 0 14px !important; }
    .navbar-header .logo.rmc-header-logo { width: 150px; min-width: 150px; height: 48px; }
    .navbar-header .logo.rmc-header-logo img { max-width: 142px; max-height: 42px; }
    .navbar-header .header-search { width: min(280px, 32vw) !important; }

    body.horizontal-layout .rmc-menu-toggle {
        display: grid !important;
        place-items: center;
        margin-left: 0 !important;
    }
    body.horizontal-layout .rmc-topbar-inner { padding: 0 14px !important; }
    body.horizontal-layout .rmc-nav {
        position: fixed !important;
        top: calc(var(--rmc-header-height) + var(--rmc-module-height)) !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        max-height: none !important;
        padding: 10px 14px 24px !important;
        overflow-y: auto;
        background: #fff;
        border-top: 1px solid var(--rmc-border);
        box-shadow: 0 18px 35px rgba(15,23,42,.12);
        opacity: 0;
        visibility: hidden;
        transform: none;
        transition: opacity .2s ease, visibility .2s ease;
    }
    body.horizontal-layout .rmc-nav.show { opacity: 1; visibility: visible; transform: none !important; }
    body.horizontal-layout .rmc-nav-list { display: block !important; }
    body.horizontal-layout .rmc-nav-item { width: 100%; }
    body.horizontal-layout .rmc-nav-item > a,
    body.horizontal-layout .rmc-dropdown-toggle {
        width: 100%;
        height: 43px !important;
        justify-content: flex-start;
        margin-bottom: 3px;
        font-size: 14px !important;
    }
    body.horizontal-layout .rmc-dropdown-toggle .arrow { margin-left: auto; }
    body.horizontal-layout .rmc-dropdown-menu,
    body.horizontal-layout .rmc-dropdown-wide,
    body.horizontal-layout .rmc-dropdown-right,
    body.horizontal-layout .rmc-nav-item:nth-last-child(-n+4) > .rmc-dropdown-menu {
        position: static !important;
        display: none;
        width: 100% !important;
        max-width: 100% !important;
        max-height: none;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        margin: 2px 0 8px !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none !important;
        background: #f8fafc !important;
    }
    body.horizontal-layout .rmc-nav-item.dropdown.open > .rmc-dropdown-menu { display: block !important; }
    body.horizontal-layout .rmc-nav-item.dropdown.open > .rmc-dropdown-wide { display: grid !important; }
    body.horizontal-layout .rmc-nav-item.dropdown:hover > .rmc-dropdown-menu { display: none; }
    body.horizontal-layout .rmc-nav-item.dropdown.open:hover > .rmc-dropdown-menu { display: block !important; }
    body.horizontal-layout .rmc-nav-item.dropdown.open:hover > .rmc-dropdown-wide { display: grid !important; }
}

@media (max-width: 991.98px) {
    body.horizontal-layout .rmc-menu-toggle {
        display: none !important;
    }
    body.horizontal-layout .rmc-nav {
        pointer-events: none;
        z-index: 1090 !important;
        top: var(--rmc-header-height, 56px) !important;
    }
    body.horizontal-layout .rmc-nav.show {
        pointer-events: auto;
    }
}

@media (max-width: 767.98px) {
    :root { --rmc-header-height: 56px; --rmc-module-height: 48px; }
    .navbar-header { padding: 0 10px !important; }
    .navbar-header .topbar-menu { gap: 6px; }
    .navbar-header .logo.rmc-header-logo { width: 122px; min-width: 122px; height: 44px; }
    .navbar-header .logo.rmc-header-logo img { max-width: 116px; max-height: 38px; }
    .navbar-header .header-search { display: none !important; }
    .navbar-header .header-item.me-2 { margin-right: 5px !important; }
    .navbar-header .topbar-menu .header-item .topbar-link { width: 34px; height: 34px; padding: 4px; }
    .navbar-header .header-line { display: none; }
    .navbar-header .profile-img { width: 36px !important; height: 36px !important; }
    /* Keep only useful actions on narrow phones */
    .navbar-header .header-item:first-child,
    .navbar-header .btnFullscreen { display: none !important; }

    body.horizontal-layout .rmc-dropdown-wide { grid-template-columns: 1fr !important; }
    body.horizontal-layout .page-wrapper .content { padding: 14px 10px; }

    .card-body { padding-left: 12px; padding-right: 12px; }
    .table-responsive > .table { min-width: 760px; }
    .dropdown-menu.dropdown-menu-end { max-width: calc(100vw - 20px); }
}

@media (max-width: 420px) {
    .navbar-header .logo.rmc-header-logo { width: 105px; min-width: 105px; }
    .navbar-header .logo.rmc-header-logo img { max-width: 100px; }
    .navbar-header .topbar-menu .header-item .topbar-link { width: 32px; height: 32px; }
}

@media print {
    .navbar-header, .rmc-modulebar { display: none !important; }
    body.horizontal-layout .page-wrapper .content { padding: 0 !important; }
}
