/* GSI: Keycloak login theme.
 *
 * Supports desktop/mobile and light/dark modes.
 *
 * Requires following files:
 *
 *   * `footer.ftl`
 *   * `resources/img/gsi-fair.svg`
 *   * `resources/img/gsi-fair_dark.svg`
 *
 * Modifications to the `keycloak.v2` theme are marked by comments starting with `GSI:`. 
 */

/* GSI: Define color palette. */
:root {
    --gsi-orange: #ffb446;
    --gsi-blue: #00599c;
    --gsi-dark-grey: #333;
    --gsi-medium-grey: #666;
    --gsi-light-grey: #999;
    --gsi-white-grey: #eaeaea;
}

/* GSI: Override top bar color. */
:root {
    /*
    --keycloak-logo-url: url('../img/keycloak-logo-text.svg');
    --keycloak-bg-logo-url: url("../img/keycloak-bg-darken.svg");
    --keycloak-logo-height: 63px;
    --keycloak-logo-width: 300px;
    */
    /*--keycloak-card-top-color: var(--gsi-orange);*/
}

/* GSI: Override link related colors for light mode. */
:root {
    --pf-v5-global--link--Color: var(--gsi-blue);
    --pf-v5-global--link--Color--hover: var(--gsi-blue);
    --pf-v5-global--BorderRadius--sm: 0;
}

/* GSI: Override link related colors for dark mode. */
:root:where(.pf-v5-theme-dark) {
    --pf-v5-global--link--Color: var(--gsi-orange);
    --pf-v5-global--link--Color--hover: var(--gsi-orange);
}

/* GSI: Override button related colors. */
.pf-v5-c-button {
    --pf-v5-global--primary-color--100: var(--gsi-orange); /* light */
    --pf-v5-global--primary-color--300: var(--gsi-orange); /* dark */
    /*--pf-v5-c-button--m-primary--BackgroundColor: var(--gsi-orange);*/

    --pf-v5-global--primary-color--200: var(--gsi-blue); /* light, dark */
    /*--pf-v5-c-button--m-primary--hover--BackgroundColor: var(--gsi-blue);*/
    --pf-v5-c-button--m-secondary--Color: var(--gsi-dark-grey);
    --pf-v5-c-button--m-secondary--hover--Color: var(--gsi-dark-grey);

    cursor: pointer;
}
.pf-v5-c-button.pf-m-primary {
    color: var(--gsi-dark-grey);
}
.pf-v5-c-button.pf-m-primary:hover {
    color: white;
}

/* GSI: Override grid layout making footer sticky. */
.pf-v5-c-login {
    --pf-v5-c-login__header--PaddingRight: 0;
    --pf-v5-c-login__header--PaddingLeft: 0;
    --pf-v5-c-login__footer--PaddingRight: 0;
    --pf-v5-c-login__footer--PaddingLeft: 0;

    align-items: normal;
    padding: 25px 25px;
    padding-bottom: 0;
}
.pf-v5-c-login__container {
    max-width: none;
    grid-template-columns: minmax(400px, 576px);
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "header"
                         "main"
                         "footer";
    display: grid;
    justify-content: center;
}
footer {
    grid-area: footer;
    display: flex;
    flex-direction: row;
    height: 225px;
    margin-top: 25px;
}

.pf-v5-c-login__main {
    box-shadow: none;
    border-style: solid;
    border-width: 2px;
    border-color: var(--gsi-white-grey);
}

.pf-v5-c-login__main-header {
    border-top: 4px solid var(--keycloak-card-top-color);
}

/* Info section - top margin + bottom padding */
.pf-v5-c-login__main-footer-band:first-child {
    margin-block-start: var(--pf-v5-global--spacer--lg);
}

.pf-v5-c-login__main-footer-band:last-child {
    padding-bottom: 0;
}
/* Info section */

/* GSI: Place GSI/FAIR logo for light mode. */
.pf-v5-c-login__header {
    padding-top: 150px;
    background: url('../img/gsi-claim.svg') left top / 100% no-repeat;
}

/* GSI: Move page further up. */
#kc-header {
    margin-top: 0;
}

#kc-login-footer-left {
    flex-grow: 1;
    background-color: var(--gsi-orange);
}
#kc-login-footer-right {
    margin-left: 5px;
    background-color: var(--gsi-blue);
}
#kc-login-footer-right img {
    width: 180px;
    height: 69.5px;
}

/* GSI: Stylize footer links. */
#kc-login-footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 33%;
    justify-content: space-between;
    padding: 1em 2em;
    font-size: 8pt;
}
#kc-login-footer-links li {
    position: relative;
    display: block;
    height: 1em;
    line-height: 1em;
    padding-left: 1.5em;
    text-transform: uppercase;
}

#kc-login-footer-links li::before {
    position: absolute;
    left: 0px;
    display: block;
    height: 1em;
    aspect-ratio: 1/1;
    content: "";
    background-color: var(--gsi-dark-grey);
}

#kc-login-footer-links li:hover::before {
    background-color: white;
}
#kc-login-footer-links a {
    display: inline;
    color: var(--gsi-dark-grey);
}
#kc-login-footer-links a:hover {
    text-decoration: none;
}

/* GSI: Place GSI/FAIR logo for dark mode. */
:where(.pf-v5-theme-dark) .pf-v5-c-login__header {
    background-image: url('../img/gsi-fair_dark.svg');
}

/* GSI: Remove Keycloak background. */
.login-pf body {
    /*
    background: url("../img/keycloak-bg.png") no-repeat center center fixed;
    background-size: cover;
    */
    height: 100%;
}

div.kc-logo-text {
    /*background-image: var(--keycloak-logo-url);*/
    height: var(--keycloak-logo-height);
    width: var(--keycloak-logo-width);
    background-repeat: no-repeat;
    background-size: contain;
    margin: 0 auto;
}

div.kc-logo-text span {
    display: none;
}

.kc-login-tooltip {
    position: relative;
    display: inline-block;
}

.kc-login-tooltip .kc-tooltip-text {
    top:-3px;
    left:160%;
    background-color: black;
    visibility: hidden;
    color: #fff;

    min-width:130px;
    text-align: center;
    border-radius: 2px;
    box-shadow:0 1px 8px rgba(0,0,0,0.6);
    padding: 5px;

    position: absolute;
    opacity:0;
    transition:opacity 0.5s;
}

/* Show tooltip */
.kc-login-tooltip:hover .kc-tooltip-text {
    visibility: visible;
    opacity:0.7;
}

/* Arrow for tooltip */
.kc-login-tooltip .kc-tooltip-text::after {
    content: " ";
    position: absolute;
    top: 15px;
    right: 100%;
    margin-top: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent black transparent transparent;
}

#kc-recovery-codes-list {
    columns: 2;
}

#certificate_subjectDN {
    overflow-wrap: break-word
}

#kc-verify-email-form {
    margin-top: 24px;
    margin-bottom: 24px;
}

/* GSI: Invert realm title color as background color was effectively inverted. */
#kc-header-wrapper {
    /*font-size: 29px;*/
    font-size: 15pt;
    font-weight: bold;
    /*text-transform: uppercase;
    letter-spacing: 3px;
    line-height: 1.2em;
    white-space: normal;*/
    color: var(--gsi-medium-grey) !important;
    background-color: var(--gsi-white-grey);
    /*color: var(--pf-v5-global--Color--light-100) !important;*/
    /*color: var(--pf-v5-global--Color--dark-100) !important;*/
    color: var(--gsi-light-grey);
    /*background-color: var(--gsi-white-grey);*/
    height: 1.2em;
    line-height: 1.2em;

    position: relative;
    padding-left: 1.5em;
}
#kc-header-wrapper::before{
    position: absolute;
    left: 0;
    height: 1.2em;
    aspect-ratio: 1/1;
    content: "";
    background-color: var(--gsi-medium-grey);
}

#kc-page-title {
    position: relative;
    padding-left: 1.5em;
    height: 1em;
    line-height: 1em;
    font-size: 15pt;
    color: var(--gsi-medium-grey);
}

#kc-page-title::before{
    position: absolute;
    left: 0;
    height: 1em;
    aspect-ratio: 1 / 1;
    content: ""; 
    background-color: var(--gsi-orange);
}

/* GSI: Toggle inverted realm title color for dark mode. */
:where(.pf-v5-theme-dark) #kc-header-wrapper {
    color: var(--pf-v5-global--Color--light-100) !important;
}

hr {
    margin-top: var(--pf-v5-global--spacer--sm);
    margin-bottom: var(--pf-v5-global--spacer--md);
}

#kc-social-providers svg:not(.google) {
    filter: invert(47%) sepia(88%) saturate(7486%) hue-rotate(199deg) brightness(91%) contrast(101%);
}

#kc-social-providers svg {
    height: var(--pf-v5-global--FontSize--xl);
}

:where(.pf-v5-theme-dark) #kc-social-providers svg:not(.google) {
    filter: invert(54%) sepia(96%) saturate(2028%) hue-rotate(174deg) brightness(99%) contrast(97%);
}

@media (min-width: 526px) {
    .pf-v5-c-login__header {
        background-size: 476px;
    }
@media (min-width: 626px) {
    #kc-login-footer-links {
        flex-direction: row;
    }
    div.pf-v5-c-login__main-header {
        grid-template-columns: 65% 35%;
    }
    footer {
        height: 100px;
    }
}
