/* Legacy Bootstrap breakpoints do not account for CSS zoom. */
html.care-mode .container {
    max-width: 100%;
}

/* Older homepages use 1000px sections, including inline banner widths. */
html.care-mode .combar,
html.care-mode .combar .module,
html.care-mode .sloganbar > div {
    box-sizing: border-box;
    max-width: 100%;
}

html.care-mode .combar img,
html.care-mode .sloganbar img,
html.care-mode .org-module img {
    box-sizing: border-box;
    max-width: 100%;
    height: auto;
}

.care-mode-toggle {
    display: inline-block;
    box-sizing: border-box;
    min-height: 34px;
    margin: 3px 8px;
    padding: 5px 12px;
    border: 1px solid #17647b;
    border-radius: 4px;
    background: #fff;
    color: #17647b;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 22px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    cursor: pointer;
}

.care-mode-toggle:hover,
.care-mode-toggle[aria-pressed="true"] {
    background: #17647b;
    color: #fff;
}

.care-mode-toggle:focus {
    outline: 3px solid #eab308;
    outline-offset: 2px;
}

/* Reserve a separate flex item so the toggle stays visible on small screens. */
.header.top > .care-mode-topbar {
    display: flex;
    align-items: center;
}

.care-mode-topbar > .row {
    flex: 1 1 auto;
    min-width: 0;
}

.care-mode-topbar > .care-mode-toggle {
    flex: 0 0 auto;
    margin-right: 0;
    margin-left: 20px;
}

.care-mode-topbar .user-nav > .care-mode-toggle {
    float: left;
    margin: 8px 8px 8px 0;
}

/* Keep the s1 controls inside the existing right-hand Bootstrap column. */
.header.top.s1 .care-mode-actions {
    padding-right: 5px;
}

.header.top.s1 .care-mode-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    min-height: 50px;
    margin-right: 0;
}

.header.top.s1 .care-mode-actions-row > .top-search-box-wrap-ph {
    flex: 1 1 45px;
    min-width: 45px;
    width: auto;
    padding: 0 5px 0 0;
}

.header.top.s1 .care-mode-actions .top-search-box .focus {
    width: 100%;
    min-width: 0;
}

.header.top.s1 .care-mode-actions-row > .user-nav {
    flex: 0 0 auto;
    width: auto;
}

.header.top.s1 .care-mode-actions-row > .care-mode-toggle {
    flex: 0 0 auto;
    margin-right: 5px;
    margin-left: 0;
    padding-right: 5px;
    padding-left: 5px;
}

.bhMenuNav .navbar > .care-mode-toggle {
    flex-shrink: 0;
    margin-left: auto;
}

.care-mode-toolbar {
    padding: 5px 15px;
    background: #fff;
    text-align: right;
}

.topMenu > .container > .care-mode-toggle,
#user-info-main > .container > .care-mode-toggle {
    float: right;
}

.lessonTitle > .care-mode-toggle {
    display: block;
    margin-left: auto;
}

/* Both teaching management headers share the same account/control alignment. */
.aheader .care-mode-admin-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

.aheader .care-mode-admin-row::before,
.aheader .care-mode-admin-row::after {
    display: none;
}

.aheader .care-mode-admin-row > .htitle {
    flex: 1 1 200px;
    width: auto;
}

.aheader .care-mode-admin-row > .care-mode-admin-actions {
    flex: 0 1 auto;
    width: auto;
    margin-left: auto;
}

.aheader .care-mode-admin-actions,
.aheader .care-mode-admin-account {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

.aheader .care-mode-admin-actions {
    justify-content: flex-end;
}

.aheader .care-mode-admin-account > .care-mode-toggle {
    flex: 0 0 auto;
    margin: 0;
}

.aheader .care-mode-admin-account > .adm {
    float: none;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

.aheader .care-mode-admin-actions > .userbar {
    display: flex;
    align-items: center;
    gap: 6px;
    float: none;
    height: auto;
    margin: 0;
}

.aheader .care-mode-admin-actions > .userbar input[type="button"] {
    margin-left: 0;
}

.aheader .care-mode-admin-actions > .top-bar-lang {
    float: none;
    margin: 0;
    padding: 0;
}

@media (max-width: 767px) {
    .care-mode-topbar > .care-mode-toggle {
        margin-left: 8px;
        padding-right: 2px;
        padding-left: 5px;
    }

    .header.top.s1 > .container {
        padding-right: 8px;
        padding-left: 8px;
    }

    .header.top.s1 .care-mode-header-row {
        display: flex;
        align-items: center;
        gap: 6px;
        min-height: 50px;
        margin: 0;
    }

    .header.top.s1 .care-mode-header-row::before,
    .header.top.s1 .care-mode-header-row::after,
    .header.top.s1 .care-mode-actions-row::before,
    .header.top.s1 .care-mode-actions-row::after {
        display: none;
    }

    .header.top.s1 .care-mode-navigation {
        position: absolute;
        width: 0;
        padding: 0;
    }

    .header.top.s1 .care-mode-actions {
        flex: 1 1 0;
        min-width: 0;
        width: 0;
        padding: 0;
    }

    .header.top.s1 .care-mode-actions-row {
        flex-wrap: nowrap;
        gap: 6px;
        margin: 0;
    }

    .header.top.s1 .care-mode-actions-row > .care-mode-back {
        flex: 0 0 24px;
        width: 24px;
        padding: 0;
    }

    .header.top.s1 .care-mode-back .top-back-btn {
        top: 0;
        width: 24px;
        height: 34px;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        color: #00bcd4;
        font-size: 24px;
        line-height: 34px;
    }

    .header.top.s1 .care-mode-actions-row > .top-search-box-wrap-ph {
        flex: 1 1 0;
        min-width: 24px;
        padding: 0;
    }

    .header.top.s1 .care-mode-actions .top-search-box {
        display: flex;
        align-items: center;
        height: 34px;
        padding-top: 0;
        padding-bottom: 0;
        padding-left: 2px;
    }

    .header.top.s1 .care-mode-actions .top-search-box form {
        flex: 1 1 0;
        min-width: 0;
        margin-right: 20px;
    }

    .header.top.s1 .care-mode-actions .top-search-box .focus {
        padding-right: 0;
        padding-left: 0;
    }

    .header.top.s1 .care-mode-actions-row > .care-mode-toggle {
        height: 34px;
        margin: 0;
    }

    .header.top.s1 .care-mode-menu {
        flex: 0 0 32px;
        width: 32px;
        padding: 0;
    }

    .header.top.s1 .navbar-toggle {
        float: none;
        width: 32px;
        height: 34px;
        margin: 0;
        padding: 6px 4px;
    }

    .header.top.s1 .care-mode-back .top-back-btn:focus,
    .header.top.s1 .navbar-toggle:focus {
        outline: 3px solid #eab308;
        outline-offset: 2px;
    }

    .header.top:not(.s1) .care-mode-topbar > .row {
        display: flex;
        align-items: center;
    }

    .header.top:not(.s1) .care-mode-topbar > .row > .col-xs-6 {
        flex: 1 1 auto;
        min-width: 0;
        width: 0;
    }

    .header.top:not(.s1) .care-mode-topbar > .row > .col-xs-4 {
        flex: 0 0 auto;
        width: auto;
    }

    .header.top:not(.s1) .user-nav {
        display: flex;
        align-items: center;
    }
}

@media print {
    .care-mode-toggle {
        display: none !important;
    }
}
