/* Thème Weishardt — realm weishardt-openvpn-admin (SW-3686) */

.login-pf {
    background: #eef1f5 !important;
}

.login-pf body {
    background: #eef1f5;
    height: 100%;
}

.login-pf-page {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100vh;
    box-sizing: border-box;
    padding: 8vh 20px 40px;
}

textarea.pf-c-form-control {
    height: auto;
}

/* Champs et bouton, alignes sur la maquette */
input.pf-c-form-control,
.pf-c-form-control {
    box-sizing: border-box;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d7dce3;
    border-radius: 6px;
    font-size: 15px;
    color: #193164;
    background: #ffffff;
}

input.pf-c-form-control:focus,
.pf-c-form-control:focus {
    outline: none;
    border-color: #009DAD;
    box-shadow: 0 0 0 3px rgba(0,157,173,0.18);
}

.pf-c-form__label,
label.pf-c-form__label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #3A4F66;
    margin-bottom: 6px;
}

#kc-form-login .form-group,
#kc-form-login .kcFormGroupClass {
    margin-bottom: 16px;
}

#kc-form-buttons {
    margin-top: 6px;
}

.pf-c-button.pf-m-primary.pf-m-block {
    width: 100%;
    padding: 13px;
    background: #009DAD;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    box-shadow: none;
}

.pf-c-button.pf-m-primary.pf-m-block:hover {
    background: #007685;
}

/* Choix de la methode OTP (plusieurs appareils enregistres) : responsive, pas de recouvrement */
#kc-otp-login-form div:has(> input.pf-c-tile__input) {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}

.pf-c-tile__input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.pf-c-tile {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 140px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #d7dce3;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #3A4F66;
}

.pf-c-tile__input:checked + .pf-c-tile {
    border-color: #009DAD;
    background: rgba(0,157,173,0.08);
}

.pf-c-tile__header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.pf-c-tile__icon {
    flex: 0 0 auto;
}

.pf-c-tile__title {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* iOS/Brave peuvent transformer un numero detecte en lien malgre format-detection=no :
   neutraliser visuellement et au clic, sans toucher aux vrais liens du thème */
.pf-c-tile__title a,
.pf-c-tile__title x-apple-data-detectors {
    color: inherit !important;
    text-decoration: none !important;
    pointer-events: none !important;
}

/* Messages d'erreur/avertissement/info : couleur et fond distincts, pas du texte plat */
.pf-c-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 13px;
    line-height: 1.4;
}

.pf-c-alert.pf-m-danger {
    background: #fdecea;
    border: 1px solid #f1b4ab;
    color: #c0392b;
}

.pf-c-alert.pf-m-warning {
    background: #fff8e6;
    border: 1px solid #f0d28a;
    color: #8a6d1d;
}

.pf-c-alert.pf-m-success {
    background: #eafaf6;
    border: 1px solid #9fd9c5;
    color: #1a7a5e;
}

.pf-c-alert.pf-m-info {
    background: #e7f6f8;
    border: 1px solid #9fd3da;
    color: #09707d;
}

.pf-c-alert__icon {
    flex: 0 0 auto;
    margin-top: 1px;
}

.pf-c-alert__title {
    font-size: 13px;
}

p.instruction {
    margin: 5px 0;
}

#kc-error-message p.instruction {
    color: #c0392b;
    font-weight: 600;
}

#input-error,
.pf-c-form__helper-text.pf-m-error {
    display: block;
    margin-top: 4px;
    color: #c0392b;
    font-size: 12px;
}

.pf-c-button.pf-m-control {
    border: solid var(--pf-global--BorderWidth--sm);
    border-color: rgba(230, 230, 230, 0.5);
}

#kc-page-title {
    margin: 0 0 6px;
    font-size: 21px;
    font-weight: 700;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #193164;
    text-align: center;
}

h1#kc-page-title b {
    font-weight: 700;
}

.card-pf header.login-pf-header {
    padding-top: 32px;
}

#kc-subtitle {
    display: block;
    margin: 0 0 28px;
    font-size: 14px;
    color: #7b8697;
    text-align: center;
}

#kc-weishardt-footer {
    margin: 24px -36px -32px;
    padding: 14px 36px;
    background: #f7f9fb;
    border-top: 1px solid #edf0f3;
    border-radius: 0 0 10px 10px;
    text-align: center;
    font-size: 12px;
    color: #9aa5b1;
}

.card-pf header.login-pf-header {
    position: relative;
}

/* selecteur de langue : en flux normal (jamais en recouvrement), aligne a gauche, au-dessus du logo */
/* en japonais, le sens de lecture justifie l'inversion a droite */
#kc-locale {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 12px;
}

html[lang="ja"] #kc-locale {
    justify-content: flex-end;
}

#kc-locale-wrapper,
#kc-locale-dropdown {
    display: inline-block;
}

#kc-locale ul {
    background-color: #ffffff;
    display: none;
    position: absolute;
    top: 36px;
    left: 0;
    right: auto;
    min-width: 140px;
    padding: 0;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(16,30,54,0.15);
}

html[lang="ja"] #kc-locale ul {
    left: auto;
    right: 0;
}

#kc-locale-dropdown:hover ul {
    display: block;
}

#kc-locale-dropdown a {
    color: #3A4F66;
    font-size: 14px;
    font-weight: 600;
}

#kc-current-locale-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(25,49,100,0.06);
    color: #3A4F66;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

#kc-current-locale-link:hover {
    background: rgba(25,49,100,0.1);
}

a#kc-current-locale-link::after {
    content: "\2c5";
    margin-left: 4px;
    font-size: 10px;
}

.login-pf .container {
    padding-top: 40px;
}

.login-pf a {
    color: #009DAD;
}

.login-pf a:hover {
    color: #007685;
}

#kc-logo {
    width: 100%;
}

div.kc-logo-text {
    background-image: url(../img/weishardt-logo.png);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    height: 70px;
    width: 220px;
    margin: 0 auto;
}

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

#kc-header {
    display: none;
}

#kc-weishardt-logo {
    width: 190px;
    height: 70px;
    margin: 0 auto 24px;
    background-image: url(../img/weishardt-logo.png);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

#kc-content {
    width: 100%;
}

#kc-attempted-username {
    font-size: 20px;
    font-family: inherit;
    font-weight: normal;
    padding-right: 10px;
}

#kc-username {
    text-align: center;
    margin-bottom: 12px;
}

/* Info-bulle "Redémarrer la connexion" : absente du thème, elle restait affichée en
   permanence et chevauchait le contenu suivant. Repris du thème modèle 21.0.2. */
.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;
}

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

.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-content-wrapper {
    margin-top: 0;
}

#kc-form-wrapper {
    margin-top: 0;
}

#kc-info {
    margin: 20px -40px -30px;
}

#kc-info-wrapper {
    font-size: 13px;
    padding: 15px 35px;
    background-color: #f7f9fb;
    color: #7b8697;
}

#kc-form-options span {
    display: block;
}

#kc-form-options .checkbox {
    margin-top: 0;
    color: #7b8697;
}

#kc-terms-text {
    margin-bottom: 20px;
}

#kc-registration {
    margin-bottom: 0;
}

.subtitle {
    text-align: right;
    margin-top: 30px;
    color: #909090;
}

.required {
    color: var(--pf-global--danger-color--200);
}

#kc-totp-secret-qr-code {
    max-width: 150px;
    max-height: 150px;
}

#kc-totp-secret-key {
    background-color: #fff;
    color: #333333;
    font-size: 16px;
    padding: 10px 0;
}

/* Masquer la connexion sociale (non utilisee sur ce realm) */
.kc-social-section,
#kc-social-providers,
#kc-social-providers h2,
#kc-social-providers hr {
    display: none !important;
}

@media (min-width: 768px) {
    #kc-container-wrapper {
        position: absolute;
        width: 100%;
    }

    .login-pf .container {
        padding-right: 80px;
    }
}

@media (max-width: 767px) {
    div.kc-logo-text {
        margin: 0 auto;
        width: 150px;
        height: 50px;
    }

    #kc-form {
        float: none;
    }

    #kc-info-wrapper {
        border-top: 1px solid #edf0f3;
    }

    .login-pf .container {
        padding-top: 15px;
        padding-bottom: 15px;
    }
}

@media (min-height: 646px) {
    #kc-container-wrapper {
        bottom: 12%;
    }
}

@media (max-height: 645px) {
    #kc-container-wrapper {
        padding-top: 50px;
        top: 20%;
    }
}

.card-pf form.form-actions .btn {
    float: right;
    margin-left: 10px;
}

#kc-form-buttons {
    margin-top: 20px;
}

.login-pf-page .login-pf-brand {
    margin-top: 20px;
    max-width: 240px;
    width: 40%;
}

.card-pf {
    margin: 0 auto;
    background: #ffffff;
    box-shadow: 0 10px 40px rgba(16,30,54,0.18);
    padding: 0 36px 32px;
    max-width: 400px;
    border-radius: 10px;
    border-top: 4px solid #009DAD;
}

@media (max-width: 767px) {
    .login-pf-page .card-pf {
        max-width: none;
        margin: 0;
        padding-top: 20px;
        border-radius: 0;
        box-shadow: none;
    }
}

.login-pf-page .login-pf-signup {
    font-size: 13px;
    color: #7b8697;
}

#kc-content-wrapper .row {
    margin-left: 0;
    margin-right: 0;
}

.login-pf-page.login-pf-page-accounts {
    margin-left: auto;
    margin-right: auto;
}

.login-pf-page .btn-primary,
.pf-c-button.pf-m-primary {
    background: #009DAD !important;
    border-color: #009DAD !important;
    margin-top: 0;
}

.pf-c-button.pf-m-primary:hover {
    background: #007685 !important;
}

#kc-form-login div.form-group:last-of-type,
#kc-register-form div.form-group:last-of-type,
#kc-update-profile-form div.form-group:last-of-type,
#kc-update-email-form div.form-group:last-of-type {
    margin-bottom: 0px;
}

.no-bottom-margin {
    margin-bottom: 0;
}

#kc-back {
    margin-top: 5px;
}

/* --- Keycloak 26 (layout pf-v5) --- */

.login-pf {
    background: #eef1f5 !important;
}

.pf-v5-c-login__main-header {
    background-image: url("../img/weishardt-logo.png");
    background-repeat: no-repeat;
    background-position: center top;
    background-size: contain;
    min-height: 60px;
}

.pf-v5-c-login__main-header h1,
.pf-v5-c-login__main-header svg {
    display: none !important;
}

body,
#kc-page-title,
#kc-content,
#kc-content-wrapper,
label,
span,
p,
a,
h1,
h2,
h3 {
    color: #3A4F66;
}

#kc-page-title,
h1, h2 {
    color: #193164;
}

a {
    color: #009DAD;
}

a:hover {
    color: #007685;
}

.pf-c-form__label,
label {
    color: #3A4F66;
}

#kc-info-wrapper,
#kc-form-options,
#kc-registration {
    color: #7b8697;
}

/* --- Mode sombre (suit le navigateur) --- */
@media (prefers-color-scheme: dark) {

    .login-pf,
    .login-pf body {
        background: #0f2347 !important;
    }

    .card-pf {
        background: #193164;
        box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    }

    .pf-c-tile {
        border-color: #2e4a78;
        color: #cdd6e4;
    }

    .pf-c-tile__input:checked + .pf-c-tile {
        border-color: #009DAD;
        background: rgba(0,157,173,0.15);
    }

    .pf-c-alert.pf-m-danger {
        background: rgba(192,57,43,0.18);
        border-color: #c0392b;
        color: #ff9a8c;
    }

    #kc-error-message p.instruction {
        color: #ff9a8c;
    }

    #input-error,
    .pf-c-form__helper-text.pf-m-error {
        color: #ff9a8c;
    }

    .pf-c-alert.pf-m-warning {
        background: rgba(201,162,39,0.18);
        border-color: #c9a227;
        color: #f0d28a;
    }

    .pf-c-alert.pf-m-success {
        background: rgba(26,122,94,0.18);
        border-color: #1a7a5e;
        color: #7fe9c9;
    }

    .pf-c-alert.pf-m-info {
        background: rgba(9,112,125,0.18);
        border-color: #09707d;
        color: #8fe0ea;
    }

    .pf-v5-c-login__main-header {
        background-image: url("../img/weishardt-logo-blanc.png");
    }

    div.kc-logo-text,
    #kc-weishardt-logo {
        background-image: url(../img/weishardt-logo-blanc.png);
    }

    body,
    #kc-page-title,
    #kc-content,
    #kc-content-wrapper,
    span,
    p,
    h1,
    h2,
    h3 {
        color: #cdd6e4;
    }

    #kc-page-title,
    h1, h2 {
        color: #ffffff;
    }

    .pf-c-form__label,
    label,
    label.pf-c-form__label {
        color: #ffffff !important;
    }

    .pf-c-form-control,
    input.pf-c-form-control,
    input[type="text"],
    input[type="password"],
    input[type="email"] {
        background-color: #13284f;
        border-color: #2e4a78;
        color: #ffffff;
    }

    #kc-locale-dropdown a {
        color: #cdd6e4;
    }

    #kc-current-locale-link {
        background: rgba(255,255,255,0.10);
        color: #ffffff !important;
    }

    #kc-current-locale-link:hover {
        background: rgba(255,255,255,0.16);
    }

    #kc-locale ul {
        background-color: #193164;
    }

    #kc-info-wrapper {
        background-color: #132a52;
        color: #aeb9cc;
    }

    #kc-form-options,
    #kc-registration {
        color: #aeb9cc;
    }

    .login-pf-page .login-pf-signup {
        color: #aeb9cc;
    }

    #kc-subtitle {
        color: #aeb9cc;
    }

    #kc-weishardt-footer {
        background: #132a52;
        border-top-color: #23406b;
        color: #aeb9cc;
    }
}
