/* Helpers 
------------------------------------------------------ */
.bold {
    font-weight: 600;
}

.margin-bottom-7 {
    margin-bottom: 7px;
}

/* Containers
------------------------------------------------------ */
body * {
    box-sizing: border-box;
}

.body {
    margin: 0;
}

.login-theme {
    --infoMentorMainColour: #660896;
    --textColour: #444955;
    --formWidth: 600px;
    --loginFormWidth: 335px;
    --announcementWidth: min(calc(100% - 40px), 560px);
}

.login-container {
    color: var(--textColour);
    font-family: 'Open Sans', sans-serif;
    display: flex;
}

/* Panels
------------------------------------------------------ */
.left-panel {
    padding: 16px 0px 34px 0px;
    width: 50%;
    max-width: var(--formWidth);
    display: grid;
    gap: 0px 0px;
    grid-template-rows: max-content auto max-content;
    grid-template-areas: 
        "announcement"
        "main"
        "help";
    min-height: 100vh;
}

.need-help { grid-area: help; }
.announcement { grid-area: announcement; }

.main {
    grid-area: main;
}

/* using position: fixed allows banner to be centred & fill full height, but allows form to scroll if it exceeds page height */
.right-panel {
    position: fixed;
    display: flex;
    height: 100%;
    background-color: #F8F3FA;
    align-items: center;
    justify-content: center;
    width: max(50%, calc(100% - var(--formWidth)));
    left: min(50%, var(--formWidth));
}

.banner-image {
    background-image: url(../../images/login/login-banner-sweden.manual-cache-key.1.png);
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    width: min(100%, 1144px);
    height: 551px;
}
.banner-image.is-iceland {
    background-image: url(../../images/login/login-banner-iceland.manual-cache-key.1.png);
}

.login-form {
    width: var(--loginFormWidth);
    justify-self: center;
    margin-top: auto;
    margin-bottom: auto;
}

/* Need Help Link
------------------------------------------------------ */
.need-help {
    display: flex;
    justify-content: center;
    width: var(--loginFormWidth);
    justify-self: center;
}

.need-help-icon {
    border-radius: 50%;
    border: 1px solid var(--infoMentorMainColour);
    width: 25px;
    height: 25px;
    display: inline-block;
    margin-right: 10px;
    text-align: center;
    line-height: 1.6em;
    flex-shrink: 0;
}

.link.need-help-link {
    font-size: 16px;
    display: flex;
    align-items: center;
    width: auto;
    max-width: 100%;
    color: #0076B9;
    text-decoration: underline;
}

.link.need-help-link:visited {
    color: #0076B9;
    text-decoration: underline;
}

.link.need-help-link:hover { text-decoration: none; }
.need-help-link:hover .need-help-text { text-decoration: underline; }

/* Dialog Styles
------------------------------------------------------ */
.idp-entry:hover .alt-login-dialog-login-text-cell {
    background-color: #EBF8FE;
}

/* Announcements
------------------------------------------------------ */
.announcement {
    width: var(--announcementWidth);
    background-color: #FEF9F2;
    border: 1px solid #CA5010;
    border-radius: 5px;
    justify-self: center;
    padding: 17px;
    margin-top: 16px;
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: min-content 1fr;
    grid-template-rows: min-content 1fr;
    grid-template-areas: ". ." ". announcement-message";
}

.announcement-icon {
    margin-right: 16px;
    /* https://stackoverflow.com/a/64750654/3244751 */
    filter: invert(30%) sepia(100%) saturate(897%) hue-rotate(351deg) brightness(101%) contrast(98%);
}

.announcement-header {
    margin: 0;
    font-size: 1.1em;
}

.announcement-message {
    grid-area: announcement-message;
}

.announcement p { margin: 0 0 10px; }
.announcement p:last-child { margin-bottom: 0; }

/* Inputs
------------------------------------------------------ */
.input-group {
    position: relative;
    margin-bottom: 16px;
    width: 100%;
}

.input-container {
    position: relative;
    width: 100%;
}

.input-container:has(.password-toggle) .input {
    padding-right: 45px;
}

.input {
    width: 100%;
    padding: 10px 12px 10px 44px; /* Space for the left icon */
    border: 1px solid #DBDCDD;
    border-radius: 2px;
    font-size: 1em;
    transition: border-color 0.2s ease;
}

.input:focus {
    outline: none;
    border-color: var(--infoMentorMainColour);
    box-shadow: 0 0 0 2px rgba(102, 8, 150, 0.2);
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
}

.input-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9em;
}

ion-icon {
    visibility: hidden;
    width: 20px;
    height: 20px;
}

/* Select 
------------------------------------------------------ */
.select {
    padding: 10px 12px;
    width: 100%;
}

/* Buttons
------------------------------------------------------ */
.button {
    -webkit-appearance: none;
    width: 100%;
    border-radius: 5px;
    padding: 10px 12px;
    color: white;
    border: none;
    cursor: pointer;
    margin-bottom: 16px;
    display: inline-flex;
    font-size: 1em;
    text-decoration: none;
    justify-content: center;
}

.button__with-icon {
    display: flex;
    justify-content: unset;
    align-items: center;
    padding: 0;
}

.button__with-icon--text {
    flex-grow: 1;
    text-align: center;
    margin-right: 46px;
}

.button--purple {
    background-color: var(--infoMentorMainColour);
    margin-top: 16px;
}

.button--purple:hover {
    background-color: #4A1674;
}

.button--white {
    border: 1px solid var(--infoMentorMainColour);
    color: var(--infoMentorMainColour);
    background-color: white;
}

.button--O365-sign-in {
    background-color: #E54128;
}

.button--google-sign-in {
    background-color: #4285F4;
}

.button--commune-sign-in {
    background-color: #6C7587;
}

.button-icon {
    width: 25px;
    height: 25px;
    border-right: 1px solid #fff;
    padding: 4px 7px 4px 4px;
    box-sizing: content-box;
    left: 0;
    top: 0;
    margin: 4px 5px;
}

/* Links
------------------------------------------------------ */
.link {
    color: var(--infoMentorMainColour);
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}

    .link:hover {
        text-decoration: underline;
    }

.link--forgotten-password {
    font-size: 16px;
    margin-bottom: 16px;
}

.link--forgotten-password,
.link--forgotten-password:visited {
    color: #0076B9;
    text-decoration: underline;
}

/* Password Toggle Button
------------------------------------------------------ */
.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--textColour);
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:focus {
    outline: none;
}

.password-toggle:focus-visible {
    outline: 2px solid var(--infoMentorMainColour);
    border-radius: 50%;
}

.password-toggle ion-icon {
    width: 20px;
    height: 20px;
}

/* SSO
------------------------------------------------------ */
/* hides "or" heading if has no siblings */
.sso-buttons > div:only-child {
    display: none;
}

.sso-buttons .button:hover {
    background-color: #585E6B;
}

.heading-with-line {
    margin-bottom: 20px;
    background: white;
    display: flex;
    justify-content: center;
    padding: 0 10px;
    position: relative;
}

.heading-with-line--text {
    z-index: 1;
    background: white;
    padding: 0 25px;
}

.heading-with-line:before {
    content: '';
    border-top: 1px solid #DBDCDD;
    width: 100%;
    position: absolute;
    top: 11px;
    left: 0;
    z-index: 0;
}

/* Errors
------------------------------------------------------ */
.error-message {
    color: #CC0000;
    margin: 8px 0;
}

.error-message:last-child {
    margin-bottom: 0;
}

/* Overrides/Hacks for existing code
------------------------------------------------------ */
/* added by existing JS */
.js-hide {
    display: none;
}

/* asp.net forces errors to be display: inline. This is required to allow margin-bottom :( */
.emulate-block {
    float: left;
    clear: both;
}

/* Media Queries 
------------------------------------------------------ */
@media (max-width: 768px) {
    .controls {
        padding: 0;
    }

    .left-panel {
        width: 100%;
        margin: 0 auto;
        padding: 16px 16px 34px 16px;
        grid-template-areas: "announcement" "main" "help";
        grid-template-rows: max-content auto max-content;
        min-height: 100vh;
        justify-items: center;
    }

    .right-panel {
        display: none;
    }

    .need-help {
        padding-right: 0;
        text-align: center;
        width: 100%;
        margin-top: 20px;
        margin-bottom: 20px;
    }

    .announcement {
        width: 100%;
        max-width: none;
        margin-bottom: 20px;
    }

    .login-form {
        width: 100%;
        max-width: var(--loginFormWidth);
    }

    .link.need-help-link { 
        width: auto;
        display: flex;
        justify-content: center;
    }

    .button__with-icon {
        justify-content: flex-start;
    }
}

@media (max-width: 360px) {
    .login-form {
        width: calc(100vw - 40px);
    }
}

/* wider than mobile, but short enough for alert to push form down */
@media screen and (min-width: 769px) and (min-height: 850px)  {

    .left-panel { position: relative; }
    .announcement {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        max-height: 18vh;
        overflow-y: auto;
    }
}
    