/* BASE STYLES */

html,
body {
    font-family: Arial, Helvetica, sans-serif;
    border: 0;
    margin: 0;
    padding: 0;
    color: #444444;
    background-color: #FFFFFF;
    font-size: 14px;
    height: 100%;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
}

a {
    color: #0041EB;
    text-decoration: none;
    outline: none;
    cursor: pointer;
    font-size: 12px;
}

/* LAYOUT COMPONENTS */

.top-bar {
    width: 100%;
    min-height: 30px;
    background-color: #DBEBFF;
}

.content {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    padding-top: 48px;

    &.login-layout {
        justify-content: space-around;
        margin-top: 0;
    }
}

footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 32px 0;
    background-color: #061666;
    color: #dddddd;
    gap: 18px;
    margin: 0;
    border: none;
    font-size: 12px;

    a {
        color: #dddddd;
    }

    a.support-link {
        text-decoration: underline;

        &:hover {
            color: #ffffff;
        }
    }
}

/* FORM CONTAINER - SHARED STYLES */

.logo {
    height: 98px;
    width: auto;
    margin: 24px 0;
}

.form-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: calc(100% - 32px);
    max-width: 360px;

    form {
        display: contents;
    }

    .title {
        font-size: 20px;
        font-weight: bold;
    }

    .body-text {
        text-align: center;
        margin: 20px 0;
    }

    /* Error Messages */
    .error-container {
        min-height: 28px;
        display: inline-flex;
    }

    .error-message {
        font-size: 12px;
        color: rgb(169 21 17);

        a {
            margin-left: 4px;
        }
    }

    /* Input Fields */
    .input-container {
        width: 100%;
        display: flex;
        flex-direction: column;
        margin-bottom: 24px;
        position: relative;

        .input-sub-link {
            font-size: 12px;
            margin-top: 6px;
            align-self: flex-end;
            margin-bottom: -8px;
            &:focus-visible {
                outline: #426aec auto 1px;
            }
        }

        .error-message {
            position: absolute;
            top: 40px;
            left: 2px;
        }
    }

    input {
        box-sizing: border-box;
        outline: 0;
        width: 100%;
        height: 34px;
        padding: 6px 12px;
        font-size: 14px;
        line-height: 1.42857143;
        color: #555;
        background-color: #fff;
        border: 1px solid #ccc;
        border-radius: 4px;
        box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
        transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;

        &:focus {
            border-color: #66afe9;
            box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
        }

        &[aria-invalid=true] {
            border-color: rgb(169 21 17);
        }

        &:not([aria-invalid=true]) ~ .error-message {
            display: none;
        }
    }

    /* Buttons */
    button {
        display: block;
        width: 100%;
        height: 36px;
        color: #ffffff;
        background-color: #153AB3;
        border-radius: 50px;
        border: none;
        margin: 2px 0;
        cursor: pointer;
        font-weight: bold;

        &:hover:not(:disabled) {
            background-color: #426aec;
        }

        &:disabled {
            background-color: #cccccc;
            cursor: not-allowed;
            opacity: 0.6;
        }
    }

    /* Links */
    .back-link {
        font-size: 14px;
        margin-top: 16px;

        &:focus-visible {
            outline: #426aec auto 1px;
        }
    }

    .privacy-policy {
        text-align: center;
        margin-top: 20px;

        a {
            font-size: 14px;
        }
    }

    /* Alerts in Form */
    .password-policy-alert {
        margin-bottom: 32px;
    }

    .alert {
        margin-bottom: 24px;
    }
}

/* ALERTS */

.alert-container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto 24px auto;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 2px;
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;

    &.alert-warning {
        background: #FFFBE6;
        border: 1px solid #FFE58F;
    }

    .warning-icon {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .kc-feedback-text {
        flex: 1;
        font-size: 14px;
        line-height: 1.6;

        ol {
            margin: 8px 0 4px 0;
            padding-left: 20px;

            li {
                margin-bottom: 6px;

                &:last-child {
                    margin-bottom: 0;
                }
            }
        }
    }
}

/* PAGE-SPECIFIC STYLES */

/* Terms Page */
.content.terms-layout .form-container {
    button {
        margin: 10px 0;
    }

    #kc-decline {
        background-color: #778899;

        &:hover:not(:disabled) {
            background-color: #5a6268;
        }
    }
}

/* TOTP Configuration Page */
.content.totp-config-layout {
    margin: 64px 16px;
    padding: 0;

    .form-container {
        max-width: 600px;
    }

    #kc-totp-settings {
        font-size: 14px;
        line-height: 1.5;
        margin: 20px 0 24px 0;
        padding-left: 20px;

        li {
            margin-bottom: 16px;

            &:last-child {
                margin-bottom: 0;
            }
        }

        ul {
            margin: 6px 0;
            padding-left: 20px;
            font-size: 13px;

            li {
                margin-bottom: 4px;
            }
        }

        #kc-totp-secret-qr-code {
            max-width: 220px;
            margin: 10px 0;
        }
    }

    .one-time-text {
        font-size: 12px;
        color: #666;
        display: block;
        margin-top: 6px;
    }

    form {
        margin-bottom: 32px;
    }
}

/* OTP Page */
.content.otp-layout {
    .body-text {
        text-align: left;
    }

    .form-container button {
        min-width: 200px;
    }

    .otp-instructions {
        text-align: left;
        margin-bottom: 32px;
        font-size: 14px;
        width: 100%;

        span {
            display: block;
            margin-bottom: 12px;
            font-weight: 500;
            text-align: center;
        }

        ol {
            margin: 0;
            padding-left: 24px;
            line-height: 1.6;

            li {
                margin-bottom: 8px;
            }
        }
    }
}

/* Password Update Page */
.content.password-update-page .form-container {
    max-width: 500px;
}

/* License Container */
.liscense-container {
    display: flex;
    flex-direction: column;
    width: calc(100% - 32px);
    max-width: 800px;
    margin-top: 46px;
    margin-bottom: 24px;

    .title {
        font-weight: bold;
        font-size: 13px;
        margin-bottom: 4px;
    }

    .body-text {
        font-size: 12px;
        line-height: 1.5;
    }
}

/* SPECIFIC COMPONENT STYLES */

/* TOTP/MFA Buttons */
#saveTOTPBtn {
    width: 100%;
    font-size: 14px;
    margin: 0;
}

#cancelTOTPBtn {
    background-color: #778899;
    width: 100%;
    font-size: 14px;
    margin: 0;
    padding: 0;

    &:hover:not(:disabled) {
        background-color: #5a6268;
    }
}

/* Legacy Keycloak Styles */
.login-pf-page .card-pf {
    max-width: 540px;
}

#username {
    width: 100%;
}

#reset-text {
    font-size: 17px;
    margin: 24px 0px;
}

#reset-username-label {
    font-size: 14px;
}

#kc-form-buttons {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 16px;
    margin: 0 !important;
}

/* MEDIA QUERIES */

@media (min-width: 500px) {
    #kc-form-buttons.kc-reset-password {
        width: 100% !important;
    }
}

@media (max-width: 840px) {
    .login-pf-page .card-pf {
        margin: 0px auto;
    }
}
