/* HEADER STYLES ========================================================================== */
/* EOPG Header Styles */

html body .ontario-header {
    height: 3rem;
}

html body .ontario-header__container>.ontario-header-custom {
    flex-direction: column;
}

@media screen and (min-width:40rem) and (max-width: 72.99rem) {
    .ontario-header__container {
        display: flex;
        flex-direction: row;
        align-items: center;
    }

    html body .ontario-header__container>.ontario-header-custom {
        width: 100%;
    }


    .ontario-header__title-container {
        flex: 0 0 75%;
        /* This prevents the container from growing or shrinking */
    }

    /* Adjust the search container to take up the remaining 25% of the space */
    .header-search {
        flex: 0 0 25%;
        /* This prevents the container from growing or shrinking */
    }

    html body .ontario-header {
        padding: 0.2rem;
    }

    .ontario-header__logo-container {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }

    .ontario-header__nav-right-container,
    .ontario-header__search-close-container {
        flex: 1;
        /* Adjusts the flex-grow rate so that each element takes up equal space */
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    .ontario-header__search-toggler {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .ontario-header__nav-right-container {
        flex: 1;
        /* Allows the language toggle to grow as needed, pushing it to the right */
        display: flex;
        justify-content: flex-end;
        /* Aligns the language toggle to the far right */
        margin-left: auto;
    }

    /* Language toggle is aligned in cnter when on hover background appears */
    .ontario-header__nav-right-container a {
        /* padding-right: 0; */
        margin-right: 0;
    }

    .ontario-header__logo-container {
        flex-basis: auto;
    }
}

@media (max-width: 39.99rem) {

    /* Hide the search in the second row */
    .second-row .header-search {
        display: none;
    }

    .second-row {
        background-color: #404040;
        padding: 0.5rem 0;
    }

    html body .ontario-header__container>.ontario-header-custom {
        width: auto;
    }

    .ontario-header__title-container {
        /* Stretch the EOPG title across the row */
        flex: 0 0 100%;
    }


    html body .ontario-header {
        width: 100%;
    }

    .third-row {
        background: white;
        display: block;
    }

    .ontario-header__nav-right-container,
    .ontario-header__search-close-container {
        flex: 1;
        /* Adjusts the flex-grow rate so that each element takes up equal space */
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }

    .ontario-header__search-toggler {
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0;
        background-color: #fff;
    }

    .ontario-header__nav-right-container {
        flex: 1;
        /* Allows the language toggle to grow as needed, pushing it to the right */
        display: flex;
        justify-content: flex-end;
        /* Aligns the language toggle to the far right */

    }

    /* Language toggle is aligned in cnter when on hover background appears */
    .ontario-header__nav-right-container a {
        /* padding-right: 0; */
        margin-right: 0;
    }

    .ontario-icon {
        color: black;
        width: 36px;
        height: 36px;
    }

    .show-for-sr--medium {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        white-space: nowrap !important;
        border: 0 !important;
    }

    .header-search #ontario-search-input-field {
        width: 100%;
        border: 2px solid #404040;
        border-right: none;
    }

    .header-search .ontario-header__search-submit {
        border: 2px solid #404040;
        border-left: none;
        background-color: #0066cc;
    }

    .header-search #ontario-search-input-field:focus {
        border-color: transparent;
    }

    .header-search #ontario-search-input-field:focus~.ontario-header__search-submit {
        border-color: transparent;
    }

    .header-search .ontario-header__search-submit svg {
        fill: #ffffff;
    }
}

/* New class for the logo container for better alignment and spacing */
.ontario-header__logo-container {
    padding: auto;
    display: flex;
    align-items: center;
    justify-content: start;
    height: auto;
}

.ontario-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.second-row {
    background-color: #404040;
    padding: 0.62rem 0;
}

/* New class for the search toggler */
.ontario-header__search-toggler {
    background-color: transparent;
    border: none;
    color: #fff;
    /* Adjust the font color as needed */
}

/* New class for the title container for better visibility and alignment */
.ontario-header__title-container {
    color: #fff;
    font-size: 1.4rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: start;
    /* Align title to the start of the container */
}

.header-search form {
    width: 100%;
}

.ontario-header__title-container span {
    font-family: var(--text-raleway);
    font-weight: bold;
    font-size: 20px;
    /* Default mobile size */
}

@media (min-width: 40rem) {
    .ontario-header__title-container span {
        font-size: 1.5rem;
    }
}

.ontario-logo {
    height: 50px;
}

@media (max-width: 39.99rem) {
    .second-row {
        background-color: #404040;
        padding: 0.5rem 0;
    }
}

.ontario-header__nav-right-container span {
    font-size: 1rem;
    font-weight: 600;
}

.ontario-header-row .ontario-header__logo-container {
    padding: 0.75rem !important;
}

.ontario-row>.main-content-below-page-title-with-border {
    margin-bottom: 2rem;
}

@media screen and (min-width: 40rem) and (max-width: 73rem) {
    .ontario-header-row {
        justify-content: center;
    }

    .header-search {
        flex: 1 1 auto;
        display: flex;
        justify-content: center;
        align-items: center;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .header-search form {
        width: 50%;
        /* Ensure it expands to fill the container */
    }

    #ontario-search-input-field {
        display: none;
        transition: width 0.3s ease;
        border: 1px solid #ccc;
        padding: 0.5rem;
        border-radius: 4px;
        width: 100%;
    }

    #ontario-search-input-field.expanded {
        display: inline-block;
        width: 100%;
        /* Ensure it fills the form */
    }

    .ontario-close-button {
        display: none;
        cursor: pointer;
        margin-left: 1rem;
    }

    .ontario-search-button {
        cursor: pointer;
    }
}

@media screen and (min-width: 73rem) {
    .ontario-header__title-container {
        display: flex;
    }

    .header-search {
        flex: 0 1 auto;
    }


    #ontario-search-input-field {
        display: inline-block;

    }

    .ontario-close-button {
        display: none;
    }

    .ontario-search-button {
        display: none;
    }
}

.header-search,
.header-search:last-of-type {
    display: flex;
    align-items: center;
    margin: 0;
}

.header-search [type="search"] {
    margin: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right-width: 0;
}

.header-search [role="button"] {
    height: 100%;
    border: 2px solid;
    border-left-width: 0;
    border-top-right-radius: .25rem;
    border-bottom-right-radius: .25rem;
    padding-left: .75rem;
    padding-right: .65rem;
}

@media screen and (min-width: 40rem) and (max-width: 73rem) {
    .ontario-header__container {
        display: flex;
        flex-direction: row;
        align-items: center;
    }

    html body .ontario-header__container>.ontario-header-custom {
        width: 100%;
    }

    .ontario-header__title-container {
        flex: 0 0 75%;
        /* This prevents the container from growing or shrinking */
    }

    /* Adjust the search container to take up the remaining 25% of the space */
    .header-search {
        flex: 0 0 25%;
    }

    html body .ontario-header {
        padding: 0.2rem;
    }

    .ontario-header__logo-container {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }

    .ontario-header__nav-right-container,
    .ontario-header__search-close-container {
        flex: 1;
        /* Adjusts the flex-grow rate so that each element takes up equal space */
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    .ontario-header__search-toggler {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .ontario-header__nav-right-container {
        flex: 1;
        /* Allows the language toggle to grow as needed, pushing it to the right */
        display: flex;
        justify-content: flex-end;
        /* Aligns the language toggle to the far right */
        margin-left: auto;
    }

    /* Language toggle is aligned in cnter when on hover background appears */
    .ontario-header__nav-right-container a {
        /* padding-right: 0; */
        margin-right: 0;
    }

    .ontario-header__logo-container {
        flex-basis: auto;
    }
}

input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

@media screen and (max-width: 39.999rem) {
    .ontario-header__container.third-row {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 1.17rem 1rem;
    }

    .header-search {
        padding-left: 0;
        padding-right: 0;
    }

    .ontario-header__search-container {
        display: flex;
        width: 100%;
        max-width: none;
        padding-left: 0;
    }

    #ontario-search-input-field {
        width: 70%;
        /* Adjust as needed for proper alignment */
    }

    .ontario-close-button {
        display: block;
        margin-left: 1rem;
    }

    .ontario-search-button {
        display: block;
    }

    #ontario-header-search-close {
        margin: 0;
      background-color: white;
      color: var(--color-text);
    }
}

.ontario-header__search-close {
    background-color: #404040;
}

/**** Let's fool around a bit ****/

input[type="reset"].ontario-header__search-reset {
    right: 5.375rem;
}
input#results-search-input {
    font-size: 1rem;
    font-family: var(--text-open-sans);
    &:focus-visible {
        outline: 0 solid transparent;
    }
}
#results-search-form {
    border-radius: .25rem;
    &:focus-within {
        outline: 3px solid var(--highlight-color, #4a90e2);
        outline-offset: 0;
    }
}
#ontario-search-input-field.ontario-header__search-input.ontario-input {
    padding-right: 6.5rem;
    border-radius: .25rem;
}

@media (min-width: 40rem) {
    input[type="reset"].ontario-header__search-reset {
        right: 4.375rem;
    }
    #ontario-search-input-field.ontario-header__search-input.ontario-input {
        padding-right: 5.5rem;
    }
}

@media (min-width: 40rem) and (max-width: 72.999rem) {
    #ontario-search-form-container {
        max-width: none;
        width: calc(100% - 8.5rem);
        margin-left: 0 !important;
        padding-left: .125rem;
    }
    .search-open #ontario-search-form-container {
        display: flex !important;
    }
    .search-open #ontario-header-search-toggler {
        display: none !important;
    }
    #ontario-header-search-close, #ontario-header-search-toggler {
        padding: .625rem 1rem;
        margin-right: .125rem;
    }
    #ontario-header-search-close {
        width: fit-content;
        flex-grow: 0;
        right: 0;
        position: absolute;
        margin-left: 0;
    }
    #ontario-search-input-field {
        max-width: none;
    }
    .ontario-header-row > .ontario-header__title-container {
        display: block;
        flex-grow: 0;
        flex-basis: auto;
        flex-shrink: 1;
    }
    .ontario-header-row.search-open > .ontario-header__title-container {
        display: none !important;
    }
}

@media (max-width: 39.99rem) {
    #ontario-header-search-toggler:hover {
        background-color: transparent;
    }
}