/*
 * Auto shrink for Windows display scaling on small laptops (13-14 inch).
 * Condition : devicePixelRatio >= 1.25 (Windows scale >= 125%) AND effective viewport width <= 1600px.
 * Scale 100% (or lower) -> unchanged.
 *   125%  -> zoom 65%
 *   150%  -> zoom 65%
 *   175%+ -> zoom 55%
 * Media queries are evaluated against the un-zoomed viewport, so they stay stable after zoom is applied.
 *
 * NOTE: `zoom` does not scale viewport units (vh), so every rule that uses 100vh must be
 * compensated with --vh (= 100vh / zoom), otherwise the layout only fills (zoom * 100)% of the window height.
 * If a new rule with 100vh is added to main.css / owner.css / site.css, add its override here too.
 */
@media screen and (min-resolution: 1.25dppx) and (max-width: 1600px) {
    html { --z: 0.65; zoom: var(--z); }
}

@media screen and (min-resolution: 1.5dppx) and (max-width: 1600px) {
    html { --z: 0.65; }
}

@media screen and (min-resolution: 1.75dppx) and (max-width: 1600px) {
    html { --z: 0.55; }
}

@media screen and (min-resolution: 1.25dppx) and (max-width: 1600px) {
    :root { --vh: calc(100vh / var(--z)); }

    .wrap { min-height: var(--vh); }
    #main .section { min-height: calc(var(--vh) - 80px); }
    .box-noti .ct { max-height: calc(var(--vh) - 100px); }
    .primary { height: calc(var(--vh) - 72px); }
    .primary .content-wrapper { height: calc(var(--vh) - 72px); }
    .primary .content-wrapper.content-wrapper-report { height: calc(var(--vh) - 54px); }
    .primary .content-wrapper { height: calc(var(--vh) - 50px); }
    .primary .main-sidebar.v2 .sidebar-report { height: calc(var(--vh) - 54px); }
    .pamphlet .box-item { min-height: calc(var(--vh) - 210px); }
    .page-auth { min-height: var(--vh); }
    .profile { min-height: calc(var(--vh) - 210px); }
    .section-report { min-height: calc(var(--vh) - 70px); }
}

/*
 * Same problem for vw: `zoom` does not scale vw, so `width: calc(100vw - Npx)` ends too early
 * (blank area on the right). --vw = 100vw / zoom. !important is needed because History.cshtml
 * also sets this width inline via JS when the sidebar is toggled (260px expanded / 60px collapsed).
 */
@media screen and (min-resolution: 1.25dppx) and (max-width: 1600px) {
    :root { --vw: calc(100vw / var(--z)); }

    #section-detail-room { width: calc(var(--vw) - 590px); }
    .s-content iframe, .s-content table { max-width: calc(var(--vw) - 30px); }
}

@media screen and (min-resolution: 1.25dppx) and (min-width: 1199px) and (max-width: 1600px) {
    .primary .content-wrapper { width: calc(var(--vw) - 260px) !important; }
    .primary .main-sidebar.sidebar-collapse ~ * .content-wrapper { width: calc(var(--vw) - 60px) !important; }
}

@media screen and (min-resolution: 1.25dppx) and (max-width: 1198px) {
    #section-detail-room { width: calc(var(--vw) - 320px); }
}


.primary .main-sidebar.sidebar-collapse .sidebar-menu > ul > li .tree-view{
    z-index: 10000;
}
/*
 * Modals / popups: Bootstrap's backdrop and the wide popup dialog use 100vw / 100vh / 95vw,
 * which `zoom` does not scale (backdrop covered only ~zoom % of the window, dialog was cut).
 */
@media screen and (min-resolution: 1.25dppx) and (max-width: 1600px) {
    .modal-backdrop { width: var(--vw); height: var(--vh); }
    .modal-dialog-scrollable .modal-content { max-height: calc(var(--vh) - 1rem); }
    .modal-dialog-centered::before { height: calc(var(--vh) - 1rem); }
    .vw-100 { width: var(--vw) !important; }
    .vh-100 { height: var(--vh) !important; }
    .min-vw-100 { min-width: var(--vw) !important; }
    .min-vh-100 { min-height: var(--vh) !important; }
    .modal-dialog.popup-one-room-v1-dialog { width: calc(var(--vw) * 0.95) !important; }
}

@media screen and (min-resolution: 1.25dppx) and (min-width: 576px) and (max-width: 1600px) {
    .modal-dialog-scrollable .modal-content { max-height: calc(var(--vh) - 3.5rem); }
    .modal-dialog-centered::before { height: calc(var(--vh) - 3.5rem); }
}
