@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');

html, body {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444444;
    background-color: #F8F8F8;
    font-family: 'Helvetica', sans-serif;
}

#container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 800px;
    height: 60vh;
    background-color: #FFFFFF;
    border-radius: 10px;
    overflow: hidden;
}

form {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    gap: 10px;
    padding: 10%;
    margin: 0;
    border-right: 1px solid #DDDDDD;
    overflow: auto;
    scrollbar-width: none;
}

form::-webkit-scrollbar {
    display: none;
}

input:not([type="checkbox"]) {
    padding: 10px;
    outline: none;
    border: 1px solid #DDDDDD;
    border-radius: 5px;
    background-color: #EEEEEE;
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    background-color: #FFFFFF;
    margin: 0;
    outline: none;
    font: inherit;
    color: currentColor;
    height: 1.5rem;
    aspect-ratio: 1 / 1;
    border: 1px solid #DDDDDD;
    border-radius: 5px;
    display: grid;
    place-content: center;
    overflow: hidden;
}

input[type="checkbox"]:checked {
    background-color: #EEEEEE;
}

input[type="checkbox"]:checked::before {
    content: '✔';
}

button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #FFFFFF;
    background-color: #475967;
    outline: none;
    border: 1px solid #DDDDDD;
    cursor: pointer;
    font-size: 1.2rem;
}

button:after {
    content: '🡒';
    margin-left: auto;
    font-size: 1.2rem;
}

button span {
    width: 100%;
}

a, a:hover, a:visited, a:active {
    color: #475967;
    text-decoration: none;
    font-size: .9rem;
}

#sign-in,
#confirm {
    background-color: #F15A41;
}

.title {
    display: flex;
    justify-content: center;
    font-family: 'Roboto', sans-serif;
}

.login-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.messages {
    padding: 10px;
    font-size: .9rem;
}

#error {
    border: 1px solid #FF8888;
    background-color: #FFEEEE;
}

#warning {
    background: #FFFFBB;
    border: #BBBB88 solid 1px;
}

#info {
    background: #BBDDFF;
    border: #88BBFF solid 1px;
}

#error:not(:has(span)),
#warning:not(:has(span)),
#info:not(:has(span)) {
    display: none;
}

#two-factor-auth {
    display: none;
    grid-template-rows: auto;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #DDDDDD;
    align-items: center;
}

form[data-requires-2fa="true"] #two-factor-auth {
    display: grid;
}

#authcode-message {
    grid-column: span 3;
}

#others {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    align-items: center;
}

#forgot-username {
    grid-column: 1;
    grid-row: 1;
}

#forgot-password {
    grid-column: 1;
    grid-row: 2;
}

#sso {
    grid-column: 2;
    grid-row: span 2;
}

#buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#branding {
    background: url("/ra-web/images/login-branding.png") no-repeat;
    background-size: cover;
}

label {
    text-align: center;
    font-size: .9rem;
}

#username-message {
    margin-top: 20px;
}

#instance-details {
    position: absolute;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    font-size: .8rem;
}

#instance-details span:first-child {
    margin-right: auto;
}

#captcha {
    display: flex;
    justify-content: flex-start;
    padding-top: 10px;
    border-top: 1px solid #DDDDDD;
}

@scope (form:not([data-ctx])) {
    input[name="email"],
    #username-message,
    #email-message,
    #confirm,
    #back {
        display: none;
    }
}

@scope (form[data-ctx="forgot-username"]) {
    input[name="username"],
    .password-wrapper,
    #username-message,
    .title,
    #others,
    #sign-in {
        display: none !important;
    }
}

@scope (form[data-ctx="forgot-password"]) {
    .password-wrapper,
    .title,
    #others,
    #sign-in {
        display: none !important;
    }
}

@scope ([data-path="cti"], [data-path="demo"]) {
    #others {
        display: flex;
        flex-direction: row;
        gap: 10px;
    }

    #SSO {
        display: none !important;
    }
}

@media (max-width: 800px) {
    #container {
        grid-template-columns: 1fr;
        width: 100%;
        height: 100%;
    }

    form {
        border-right: none;
        justify-content: flex-start;
        gap: 20px;
    }

    #branding {
        display: none;
    }
}

@scope (form:not([data-ctx]):has(#captcha:not([data-success="true"]))) {
    #username,
    #password,
    #others,
    #buttons,
    :scope[data-requires-2fa="true"] #two-factor-auth {
        display: none;
    }

    :scope {
        justify-content: flex-start;
    }
}

@scope(#instance-details:not(:hover)) {
    :scope {
        width: fit-content !important;
    }

    :scope::after {
        content: "Instance Details";
    }

    * {
        display: none;
    }
}

@scope(.password-wrapper) {
    :scope {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        border: 1px solid #DDDDDD;
        border-radius: 5px;
        background-color: #CCCCCC;
        overflow: hidden;
    }

    input:not([type="checkbox"]) {
        border: none;
        border-radius: 0;
    }

    .password-toggle {
        height: 35px;
        background-color: #CCCCCC;
        border-left: 1px solid #DDDDDD;
        cursor: pointer;
    }

    svg {
        width: 100%;
        height: 100%;
    }
}