:root {
    /* Need the px or it won't work inside calc expression */
    --window-inset-top: 0px;
    --window-inset-bottom: 0px;
    --window-inset-left: 0px;
    --window-inset-right: 0px;
    --logo-object-position: left center;
    --extra-padding-top: 0em;
    --header-height: 5.525em;
    /* this is here for now instead of headroom.css to ensure it is loaded in time for the js */
    --env-inset-top: env(safe-area-inset-top);
}

/* this @supports shouldn't be necessary because browsers should ignore what they don't support, but that doesn't seem to be the case with tizen or legacy edge
   don't use env as part of the supports check because then tizen falsely considers it supported
*/
@supports (height: calc(3.125em + 2 * max(3em,4em))) {

    :root {
        --header-height: calc(4.325em + max(1.2em, env(safe-area-inset-top, 0)));
    }
}

/* need a supports here because the css vars ponyfill will just grab everything matching :root */
@supports (color: var(--fake-var)) {

    .withHeaderTabs:root {
        --extra-padding-top: .4em;
    }

    .rtl:root {
        --logo-object-position: right center;
    }

    .withheadernowplaying:root {
        --header-height: 9.125em;
    }
}

/* this @supports shouldn't be necessary because browsers should ignore what they don't support, but that doesn't seem to be the case with tizen or legacy edge
   don't use env as part of the supports check because then tizen falsely considers it supported
*/
@supports (height: calc(3.125em + 2 * max(3em,4em))) {

    .withheadernowplaying:root {
        /* add 4.8em for nowplaying size */
        --header-height: calc(9.125em + env(safe-area-inset-top, 0));
    }
}

.skinHeader {
    /* This will ensure it is on top of the main body */
    z-index: 1;
    display: -webkit-flex;
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    box-sizing: border-box;
    height: var(--header-height);
    -webkit-align-items: flex-start;
    align-items: flex-start;
    contain: strict;
    padding-top: 1.2em;
    padding-left: 0;
    padding-left: env(safe-area-inset-left, 0);
    padding-right: 0;
    padding-right: env(safe-area-inset-right, 0);
    -webkit-align-content: flex-start;
    align-content: flex-start;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
}

@media not all and (min-width: 128em) {

    .withHeaderTabs.withFullDrawer:not(.layout-tv):root {
        /* this is the base height from .skinHeader + .75em (header middle margin) + 40.36px/14.24 (header middle height) */
        --header-height: 7.91em;
    }

    /* this @supports shouldn't be necessary because browsers should ignore what they don't support, but that doesn't seem to be the case with tizen or legacy edge
   don't use env as part of the supports check because then tizen falsely considers it supported
*/
    @supports (height: calc(3.125em + 2 * max(3em,4em))) {

        .withHeaderTabs.withFullDrawer:not(.layout-tv):root {
            --header-height: calc(6.71em + max(1.2em, env(safe-area-inset-top, 0)));
        }
    }

    .withheadernowplaying.withHeaderTabs.withFullDrawer:not(.layout-tv):root {
        /* add 4.8em for nowplaying size */
        --header-height: 11.51em;
    }

    @supports (height: calc(3.125em + 2 * max(3em,4em))) {

        .withheadernowplaying.withHeaderTabs.withFullDrawer:not(.layout-tv):root {
            /* add 4.8em for nowplaying size */
            --header-height: calc(11.51em + env(safe-area-inset-top, 0));
        }
    }
}

@media not all and (min-width: 120em) {

    .withHeaderTabs:not(.layout-tv):root {
        /* this is the base height from .skinHeader + .75em (header middle margin) + 40.36px/14.24 (header middle height) */
        --header-height: 7.91em;
    }

    /* this @supports shouldn't be necessary because browsers should ignore what they don't support, but that doesn't seem to be the case with tizen or legacy edge
   don't use env as part of the supports check because then tizen falsely considers it supported
*/
    @supports (height: calc(3.125em + 2 * max(3em,4em))) {

        .withHeaderTabs:not(.layout-tv):root {
            --header-height: calc(6.71em + max(1.2em, env(safe-area-inset-top, 0)));
        }
    }

    .withheadernowplaying.withHeaderTabs:not(.layout-tv):root {
        /* add 4.8em for nowplaying size */
        --header-height: 11.51em;
    }

    @supports (height: calc(3.125em + 2 * max(3em,4em))) {

        .withheadernowplaying.withHeaderTabs:not(.layout-tv):root {
            /* add 4.8em for nowplaying size */
            --header-height: calc(11.51em + env(safe-area-inset-top, 0));
        }
    }
}

@media not all and (min-width: 66em) {

    .withHeaderTabs.withFullDrawer:not(.layout-tv):root, .withHeaderTabs:not(.layout-tv):root {
        /* this is the base height from .skinHeader + 40.36px/14.24 (header middle height) */
        --header-height: 7.16em;
    }

    /* this @supports shouldn't be necessary because browsers should ignore what they don't support, but that doesn't seem to be the case with tizen or legacy edge
   don't use env as part of the supports check because then tizen falsely considers it supported
*/
    @supports (height: calc(3.125em + 2 * max(3em,4em))) {

        .withHeaderTabs.withFullDrawer:not(.layout-tv):root, .withHeaderTabs:not(.layout-tv):root {
            --header-height: calc(5.96em + max(1.2em, env(safe-area-inset-top, 0)));
        }
    }

    .withheadernowplaying.withHeaderTabs.withFullDrawer:not(.layout-tv):root, .withheadernowplaying.withHeaderTabs:not(.layout-tv):root {
        /* add 4.8em for nowplaying size */
        --header-height: 10.76em;
    }

    @supports (height: calc(3.125em + 2 * max(3em,4em))) {

        .withheadernowplaying.withHeaderTabs.withFullDrawer:not(.layout-tv):root, .withheadernowplaying.withHeaderTabs:not(.layout-tv):root {
            /* add 4.8em for nowplaying size */
            --header-height: calc(10.76em + env(safe-area-inset-top, 0));
        }
    }
}

html, body {
    margin: 0 !important;
    padding: 0 !important;
    height: 100%;
    /* Needed to prevent a horizontal scrollbar when animating */
    overflow-x: hidden;
    overflow-anchor: none;
}

.noScrollY {
    overflow-y: hidden;
}

.layout-tv {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

@media not all and (pointer: fine) {
    html {
        -webkit-touch-callout: none;
        /* technically not needed because autoprefixer will handle this, but it makes it easier to develop on ios */
        -webkit-user-select: none;
        user-select: none;
    }
}

/* Used on document.body to lock document level scrolling when dialogs are open */
.withDialogOpen {
    overflow-y: hidden !important;
    /* Have to use this instead of none, otherwise the slideshow can't zoom */
    touch-action: pinch-zoom !important;
}

/* Fix for android where detail screen dialogs are causing the whole screen to scroll when scrolling the dialog */
@media not all and (pointer: fine) {
    .withDialogOpen:not(.layout-tv) .view.scrollY:not(.dialog) {
        overflow-y: hidden !important;
        /* Have to use this instead of none, otherwise the slideshow can't zoom */
        touch-action: pinch-zoom !important;
    }
}

.backgroundContainer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    contain: strict;
    /* Can't do this. It causes loss of scrolling on Firefox Android
        https://emby.media/community/index.php?/topic/81799-firefox-android-cannot-swipe-scroll-on-any-listing-page
    touch-action: none; */
}

.transparentDocument, .backgroundContainer-transparent {
    background: none !important;
    background-color: transparent !important;
}

.skinBody {
    contain: style size;
}

.skinBody-withWindowScroll {
    contain: style;
}

@media not all and (min-width: 60em) {

    .drawer-docked {
        display: none !important;
        /* transform: translateX(-100%) !important;
        content-visibility: hidden; */
    }
}

.hide {
    display: none !important;
}

.page {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    contain: strict;
}

    .page.withTabs {
        container-type: inline-size;
        container-name: viewwithtabs;
    }

@media all and (min-width: 60em) {

    .drawer-docked {
        left: 0 !important;
        right: initial !important;
        inset-inline-start: 0% !important;
        inset-inline-end: initial !important;
        -webkit-transform: none !important;
        transform: none !important;
        box-shadow: none !important;
    }

    .page-withFullDrawer {
        left: 33.15ch;
        left: clamp(33.15ch, 30%, 45.5ch);
        right: 0;
        inset-inline-start: 33.15ch;
        inset-inline-start: clamp(33.15ch, 30%, 45.5ch);
        inset-inline-end: 0;
    }

    .skinHeader-withfulldrawer {
        -webkit-margin-start: 33.15ch;
        margin-inline-start: 33.15ch;
        -webkit-margin-start: clamp(33.15ch, 30%, 45.5ch);
        margin-inline-start: clamp(33.15ch, 30%, 45.5ch);
    }

    @media all and (pointer: fine) {

        .page-withFullDrawer {
            left: 29ch;
            left: calc(29ch + env(safe-area-inset-left, 0));
            right: 0;
            inset-inline-start: 29ch;
            inset-inline-start: calc(29ch + env(safe-area-inset-left, 0));
            inset-inline-end: 0;
        }

        .rtl.withFullDrawer:root .page {
            inset-inline-start: calc(29ch + env(safe-area-inset-right, 0));
        }

        .skinHeader-withfulldrawer {
            -webkit-margin-start: 29ch;
            margin-inline-start: 29ch;
            -webkit-margin-start: calc(29ch + env(safe-area-inset-left, 0));
            margin-inline-start: calc(29ch + env(safe-area-inset-left, 0));
        }

        .rtl:root .skinHeader-withfulldrawer {
            -webkit-margin-start: calc(29ch + env(safe-area-inset-right, 0));
            margin-inline-start: calc(29ch + env(safe-area-inset-right, 0));
        }
    }

    .page-withMiniDrawer {
        left: 10ch;
        right: 0;
        inset-inline-start: 10ch;
        inset-inline-end: 0;
    }

    .skinHeader-withminidrawer {
        -webkit-margin-start: 10ch;
        margin-inline-start: 10ch;
    }
}

.page-windowScroll {
    /* Have to override because it breaks scrolling when dependant on window scroll */
    contain: style size !important;
    overflow: initial !important;
    container-type: initial !important;
    container-name: initial !important;
}

.page-windowScroll, .padded-top-page {
    padding-top: 6em !important;
    padding-top: var(--header-height) !important;
    padding-top: calc(var(--header-height) + var(--extra-padding-top)) !important;
}

.margin-top-page-listheader {
    padding-top: 0 !important;
    margin-top: 14.3em !important;
    margin-top: calc(var(--header-height) + var(--extra-padding-top) + 9em) !important;
}

.animatedView-fade {
    transition: opacity 400ms ease-out;
}

.animatedView.backgroundContainer {
    /* 11 is arbitrary, yes. but it needs to be higher than what's used by card:focus */
    z-index: 11;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.animatedView-top.backgroundContainer {
    z-index: 12;
}

.animatedView.backgroundContainer::-webkit-scrollbar {
    width: 0 !important;
    display: none;
}

.animatedView-in.animatedView-fade {
    opacity: 0;
}

.animatedView-out.animatedView-fade {
    opacity: 0;
}

/*
    Forms
    */
form, .readOnlyContent {
    max-width: 90ch;
}

.auto-center {
    -webkit-margin-start: auto;
    margin-inline-start: auto;
    -webkit-margin-end: auto;
    margin-inline-end: auto;
}

.page-withDockedDrawer .auto-center {
    -webkit-margin-start: 0;
    margin-inline-start: 0;
    -webkit-margin-end: 0;
    margin-inline-end: 0;
}

.page.dialog {
    position: static;
    -webkit-flex-grow: 0;
    flex-grow: 0;
}

.listTotalRecordCount {
    margin: 0 .75em;
}

.fieldDescription {
    margin-top: .2em;
    font-weight: normal;
    white-space: normal !important;
}

.legendDescription {
    margin-top: 0;
}

/* Until there's a better place for these */
.itemsViewSettingsContainer {
    -webkit-justify-content: center;
    justify-content: center;
    padding: 1em 0 1.75em !important;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: row;
    flex-direction: row;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-align-items: center;
    align-items: center;
    font-size: 88%;
    /* this is a workaround to make it smaller so that pressing the right arrow on an items list doesn't result in navigation moving up to this bar */
    max-width: 95%;
    margin: 0 auto;
    container-type: inline-size;
    container-name: itemsviewsettingscontainer;
}

.itemsViewSettingsContainer-align-start {
    -webkit-justify-content: flex-start;
    justify-content: flex-start;
    margin: 0;
}

@supports not (container-type: inline-size) {
    @media not all and (min-width: 28em) {
        .listTotalRecordCount {
            display: none !important;
        }
    }
}

@container itemsviewsettingscontainer not (min-width: 50ch) {

    .listTotalRecordCount {
        display: none !important;
    }
}

.itemsViewSettingsContainer-fixed {
    position: fixed;
    top: 6.25em;
    top: calc(var(--header-height) + var(--extra-padding-top) + 1em);
    left: 0;
    right: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    z-index: 1;
}

/* dirty hack to detect support for column-gap in combination with flexbox, which is in Chrome 66+ and iOS 14.1+.
   support for @supports with a selector became available around the same time
*/
@supports selector(:hover) and (display: revert) and (column-gap: 1em) {

    .itemsViewSettingsContainer {
        -webkit-column-gap: 1.1ch;
        column-gap: 1.1ch;
        row-gap: 1em;
    }

    .itemsViewSettingsContainer-button, .listTotalRecordCount {
        margin: 0 !important;
    }
}

@media all and (min-width: 50em) {
    .listIconButton-autohide {
        display: none !important;
    }
}

@media not all and (min-width: 50em) {
    .listTextButton-autohide {
        display: none !important;
    }
}

button::-moz-focus-inner {
    padding: 0;
    border: 0;
}

/* Need a better spot for this. used by directory picker and other areas */
.infoBanner {
    padding: 1em;
    border-radius: .42em;
    box-shadow: 0 0.06933em 0.06933em 0 rgba(0, 0, 0, 0.14), 0 0.13866em 0.06933em -0.06933em rgba(0, 0, 0, 0.12), 0 0.06933em 0.208em 0 rgba(0, 0, 0, 0.2);
}

/* Need a better spot for this. used by directory picker and other areas */
.warningBanner {
    padding: 1em;
    border-radius: .42em;
    font-weight: 500;
}

.warningBannerIcon {
    font-size: 1.6em;
    -webkit-margin-end: .2em;
    margin-inline-end: .2em;
}

.warningBannerText {
    vertical-align: middle;
}

.rtl .autortl, .rtl-arabic .autortl-arabic {
    -webkit-transform: scaleX(-1);
    transform: scaleX(-1);
}

.focusPreviewContainer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

.focusPreviewTitle {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.focusPreviewTitleImg {
    height: 2em;
    max-width: 97%;
    margin: 0 !important;
    border: 0 !important;
    /* These are needed to prevent distorted logos in at least iOS safari */
    object-fit: contain;
    object-position: left center;
    object-position: var(--logo-object-position);
}

.focusPreviewMediaInfo {
    -webkit-flex-wrap: nowrap !important;
    flex-wrap: nowrap !important;
}

.focusPreviewOverview {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.tab-scroller-withfocuspreview {
    margin-top: 48vh;
}

.tab-scroller-withfocuspreview-padded-top-page {
    padding-top: 0 !important;
}

.cardBox-bottompadded-focuspreview {
    /* increase this a little to prevent my media labels from partially showing */
    margin-bottom: 2.4em !important;
}

.tab-scroller-withfocuspreview .sectionTitleContainer {
    margin-top: 2.5em;
}

.backdropContainer-withfocuspreview {
    left: initial;
    right: 0;
    inset-inline-start: initial;
    inset-inline-end: 0;
    -webkit-transform: scale(70%);
    transform: scale(70%);
    -webkit-transform-origin: top right;
    transform-origin: top right;
    opacity: .2;
}

/* need a way to exclude legacy edge and old tizen, lg because they're not handling the vh in the mask well */
@supports (height: calc(3.125em + 2 * max(3em,4em))) {
    .backdropContainer-withfocuspreview {
        opacity: initial;
    }

        .backdropContainer-withfocuspreview.withBackdrop {
            background-color: #000;
            -webkit-mask-image: linear-gradient(to right, transparent 0%, black 50%, black 100%), linear-gradient(to top, transparent 0%, black 50%, black 100%);
            -webkit-mask-position: center;
            -webkit-mask-repeat: no-repeat;
            -webkit-mask-composite: source-in;
        }

    .rtl .backdropContainer-withfocuspreview.withBackdrop {
        -webkit-mask-image: linear-gradient(to left, transparent 0%, black 50%, black 100%), linear-gradient(to top, transparent 0%, black 50%, black 100%);
        -webkit-transform-origin: top left;
        transform-origin: top left;
    }
}

.backgroundContainer-withfocuspreview {
    z-index: -2;
}

fieldset {
    contain: style;
    margin: 1em 0 0 0;
    padding: 0;
    border: 0;
}

legend {
    padding: 0;
    margin: 0 0 1em;
}

.emby-file-input {
    color: transparent;
}

    .emby-file-input::file-selector-button {
        display: none !important;
    }

.settingsDescriptionContainer {
    width: 52%;
    box-sizing: border-box;
    display: -webkit-flex;
    display: flex;
    -webkit-justify-content: center;
    justify-content: center;
}

.settingsDescriptionContent {
    padding-top: 1em;
}

.settingsDescriptionContent-logo {
    background-image: url(./themes/logomonochrome.png);
    background-color: transparent;
    background-position: center top;
    background-repeat: no-repeat;
    width: 100%;
    height: 60%;
    background-size: contain;
}

.settingsContentContainer-tv {
    max-width: initial;
    -webkit-padding-end: 6%;
    padding-inline-end: 6%;
}
