/*
 * Phone/tablet top bar and push-drawer menu for the logged-in pages.
 * Loaded after mobile.css. Language button on the left, menu button on the right,
 * payment / transfer buttons get visible captions, the side menu slides in from the
 * left and pushes the site to the right instead of covering it.
 */

.header-break,
.header-short-label {
    display: none;
}

@media screen and (max-width: 991px) {
    :root {
        --hdr-h: 60px;
        --drawer-w: 240px;
    }

    @supports (width: clamp(1px, 2vw, 3px)) {
        :root {
            --drawer-w: clamp(112px, 30vw, 240px);
        }
    }

    /* ---------- top bar ---------- */
    body > .header {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        height: var(--hdr-h);
        min-height: var(--hdr-h);
        z-index: 1030;
    }

    body > .header .logo {
        display: none;
    }

    body > .header .navbar {
        position: absolute !important;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: var(--hdr-h);
        min-height: var(--hdr-h);
        margin: 0;
        float: none;
    }

    body > .header .navbar-right {
        float: none;
        width: 100%;
        min-height: 0;
        padding: 0;
    }

    body > .header .navbar-right ul.navbar-nav {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        width: auto;
        float: none;
        margin: 10px 8px 0 8px;
    }

    body > .header .navbar-right ul.navbar-nav > li {
        float: none;
        flex: 0 0 auto;
        margin: 0 0 0 6px;
        position: static;
    }

    body > .wrapper {
        margin-top: var(--hdr-h) !important;
    }

    /* order: language (far left) ... actions ... logout, menu (far right) */
    body > .header ul.navbar-nav > li.language-menu {
        order: 1;
        margin: 0 auto 0 0;
        position: relative;
    }

    body > .header ul.navbar-nav > li.header-action {
        order: 2;
    }

    body > .header ul.navbar-nav > li.logout-item {
        order: 3;
    }

    body > .header ul.navbar-nav > li.mobile-menu-item {
        order: 4;
    }

    body > .header ul.navbar-nav > li.language-menu .dropdown-menu {
        position: absolute;
        top: 100%;
        left: 0 !important;
        right: auto !important;
    }

    body > .header .navbar-right ul.navbar-nav > li.logout-item > a {
        display: block;
        height: 34px;
        padding: 6px 8px;
        line-height: 22px;
        white-space: nowrap;
    }

    body > .header .logout-item .header-action-label {
        display: inline;
        font-size: 12px;
    }

    .addCash-btn {
        width: auto;
        max-width: none;
        height: 34px;
        padding: 6px 10px !important;
        font-size: 12px;
        overflow: visible;
        white-space: nowrap;
    }

    .addCash-btn .header-action-label {
        display: inline;
    }

    .addCash-btn img {
        max-width: 60px;
        max-height: 18px;
        vertical-align: middle;
    }

    /* ---------- push drawer ---------- */
    body > .wrapper > .left-side,
    body.mobile-sidebar-open > .wrapper > .left-side {
        display: block !important;
        position: fixed !important;
        top: 0;
        bottom: 0;
        padding-top: var(--hdr-h);
        left: 0 !important;
        right: auto !important;
        width: var(--drawer-w) !important;
        min-height: 0;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 1 !important;
        visibility: hidden;
        transition: visibility 0s linear .25s;
    }

    body.mobile-sidebar-open > .wrapper > .left-side {
        visibility: visible;
        transition: visibility 0s;
    }

    /* the logo is hidden in the pushed-aside top bar, so it is shown at the top of the drawer */
    body > .wrapper > .left-side::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: var(--hdr-h);
        box-sizing: border-box;
        padding: 10px 8px;
        background: url(/templates/kertas/assets/img/photo2.png) center / contain no-repeat;
        background-origin: content-box;
    }

    .left-side .sidebar {
        position: relative !important;
        width: 100% !important;
    }

    .left-side .sidebar .sidebar-menu {
        display: block;
    }

    .left-side .sidebar .sidebar-menu > li {
        width: 100%;
    }

    body > .header,
    .right-side {
        transition: transform .25s ease;
    }

    body.mobile-sidebar-open > .header,
    body.mobile-sidebar-open .right-side {
        transform: translateX(var(--drawer-w));
    }

    /* the menu button stays in place on the screen while the site slides to the right */
    body > .header ul.navbar-nav > li.mobile-menu-item {
        transition: transform .25s ease;
    }

    body.mobile-sidebar-open > .header ul.navbar-nav > li.mobile-menu-item {
        transform: translateX(calc(-1 * var(--drawer-w)));
    }

    body.mobile-sidebar-open {
        overflow-x: hidden;
    }
}

/* ---------- tablets: one row, full captions ---------- */
@media screen and (min-width: 768px) and (max-width: 991px) {
    .header-break {
        display: none;
    }
}

/* ---------- phones: two rows ---------- */
@media screen and (max-width: 767px) {
    :root {
        --hdr-h: 94px;
    }

    body > .header .navbar-right ul.navbar-nav {
        flex-wrap: wrap;
        margin: 6px 6px 0 6px;
        row-gap: 6px;
    }

    body > .header .navbar-right ul.navbar-nav > li.header-break {
        display: block;
        order: 3;
        flex: 0 0 100%;
        height: 0;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    body > .header .navbar-right ul.navbar-nav > li.logout-item > a {
        font-size: 12px;
    }

    body > .header .logout-item .header-action-label {
        font-weight: 400;
    }

    body > .header ul.navbar-nav > li.language-menu {
        order: 1;
    }

    body > .header ul.navbar-nav > li.logout-item {
        order: 1;
        margin-left: 6px;
    }

    body > .header ul.navbar-nav > li.mobile-menu-item {
        order: 2;
    }

    body > .header ul.navbar-nav > li.header-action {
        order: 4;
        flex: 1 1 30%;
        min-width: 0;
        margin: 0 0 0 4px;
    }

    body > .header ul.navbar-nav > li.header-break + li.header-action {
        margin-left: 0;
    }

    .header-action .btn-group {
        display: block;
        width: 100%;
    }

    .header-action .addCash-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 42px;
        padding: 2px 3px !important;
        font-size: 11px;
        line-height: 1.15;
        white-space: normal;
        text-align: center;
    }

    .header-action .addCash-btn .header-action-label {
        display: none;
    }

    .header-action .addCash-btn .header-short-label {
        display: block;
        font-weight: 600;
    }

    .header-action .addCash-btn .header-action-label.brand-label {
        display: block;
        font-weight: 400;
        color: #666;
    }

    /* the ruble sign sits in front of the brand name instead of taking its own line */
    .header-action .addCash-btn:not(.btn-transfer) > .fa {
        display: none;
    }

    .header-action .addCash-btn .brand-label::before {
        content: "\f158";
        font-family: FontAwesome;
        margin-right: 3px;
    }

    .header-action .addCash-btn img {
        max-height: 14px;
        max-width: 54px;
    }

    .header-action .addCash-btn.btn-transfer {
        flex-direction: row;
        gap: 4px;
    }

    .header-action .addCash-btn.btn-transfer .fa {
        font-size: 16px;
    }
}

/* ---------- phone drawer: narrow rail, icon above caption ---------- */
@media screen and (max-width: 599px) {
    .left-side .sidebar .sidebar-menu > li > a {
        padding: 10px 3px;
        text-align: center;
        font-size: 11px;
        line-height: 1.2;
        overflow-wrap: anywhere;
    }

    .left-side .sidebar .sidebar-menu > li > a > .fa {
        display: block;
        width: auto;
        margin: 0 auto 4px;
        font-size: 20px;
    }

    .left-side .sidebar .sidebar-menu > li > a > span {
        display: block;
    }

    .left-side .balance-info {
        padding: 10px 3px;
        font-size: 11px;
        text-align: center;
        overflow-wrap: anywhere;
    }

    .left-side .discount-info,
    .left-side .input-group {
        display: none;
    }
}

@media screen and (min-width: 992px) {
    .header-break,
    .header-short-label {
        display: none !important;
    }
}
