/* The login page, in the look of the Interagit apps' login (the Flutter package itg_auth, and its web twin itg_auth_web): a
 * navy to blue gradient, the white symbol, a white title, translucent rounded fields and a white pill button.
 *
 * Loaded on the login-type pages only (add_css_anonymous_page in setup.php). Everything starts from "body .page-anonymous",
 * the same start as the rules of the Branding module (inc/branding.class.php): those come after this file, so a logo, a
 * background picture or colors somebody saved in ITG Branding still win over what is set here. Values are those of
 * itg_packages/itg_auth/lib/src/ui/login_page.dart. */

/* The page: the gradient is only the background image, so a picture saved in Branding (also a background image) replaces it */
body.welcome-anonymous {
    background-image: linear-gradient(to bottom, #002a48, #2575fc);
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
    background-color: #002a48;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* The symbol (white): GLPI draws the logo as the content of the element, from --logo (the dark palette sets it with !important,
 * hence the !important here; Branding's own logo, when there is one, is later in the page and wins). It is inline (the Interagit
 * symbol of itg_auth, in white) because a url() inside a variable is read from GLPI's stylesheet, not from this file, so a path
 * to a picture of the plugin would break. */
body .page-anonymous .glpi-logo {
    --logo: url("data:image/svg+xml,%3csvg fill='%23fff' viewBox='0 0 2825.9 2834.6' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1413,0C632.6,0,0,632.6,0,1413c0,780.4,632.6,1413,1413,1413c353.4,0,675.7-130.6,923.4-345.1c70.7,80.6,317.5,352.1,436,353.8h53.5V1413C2825.9,632.6,2193.3,0,1413,0z M1413,2173.8c-420.2,0-760.8-340.6-760.8-760.8S992.8,652.1,1413,652.1s760.8,340.6,760.8,760.8S1833.2,2173.8,1413,2173.8z'/%3e%3cpath d='M2825.9,123.1c0,67.1-54,123.6-123.2,123.6c-68.9,0-122.1-55.8-122.1-122.9S2634.2,0.2,2703.4,0.2C2772.3,0.2,2825.9,55.7,2825.9,123.1z M2805.3,123.1c0-55.5-44.2-101.1-101.8-101.1c-58,0-102.2,46.4-102.2,101.9s43.9,101.1,101.5,101.1C2760.7,224.9,2805.3,178.5,2805.3,123.1z M2729.9,140.1l28.3,41h-23.9l-22.8-37h-5.4h-28.6v37h-20.7V58.6h49.3c31.9,0,49.7,15.2,49.7,42C2755.6,119.8,2746.5,133.6,2729.9,140.1z M2706,126.7c18.8,0,30.1-9.4,30.1-25.7c0-16.3-11.2-25-30.1-25h-28.6v50.7H2706z'/%3e%3c/svg%3e") !important;
    width: 150px;
    height: 150px;
    object-fit: contain;
}

body .page-anonymous .container-tight {
    max-width: 400px;
    padding-top: .5rem !important;
    padding-bottom: .5rem !important;
}

/* Centred vertically: the page is as tall as the window and its content sits in the middle of it (GLPI pushes it down with a top margin) */
body.welcome-anonymous .page-anonymous {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
body.welcome-anonymous .page-anonymous > .flex-fill {
    justify-content: center;
    margin-top: 0 !important;
}
body .page-anonymous .glpi-logo {
    margin-bottom: .5rem !important;
}

/* One column, as in the app: the form (the fields are 350 pixels at most) and, when there is one, GLPI's text and FAQ link below it */
body .page-anonymous .card .row {
    flex-direction: column;
    align-items: center;
    margin: 0;
}
body .page-anonymous .card .row > .col-md-5,
body .page-anonymous .card .row > .col-auto {
    width: 100%;
    max-width: 350px;
    padding: 0;
}
body .page-anonymous .card .row > .col-auto {
    margin-top: 1.5rem;
}

/* The box: no card, the form sits straight on the gradient */
body .page-anonymous .card {
    background: transparent;
    border: 0;
    box-shadow: none;
    color: #fff;
}
body .page-anonymous .card .card-body {
    padding-left: 0;
    padding-right: 0;
}
body .page-anonymous .card .card-header {
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
}
body .page-anonymous .card .card-header h2 {
    margin: 0 0 .5rem;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    text-align: center;
}

/* The fields */
body .page-anonymous .card .form-label,
body .page-anonymous .card .form-check-label {
    color: rgba(255, 255, 255, .7);
}
body .page-anonymous .card .form-control,
body .page-anonymous .card .form-select {
    padding: .6rem .9rem;
    font-size: 15px;
    color: #fff;
    background-color: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 12px;
    box-shadow: none;
}
body .page-anonymous .card .form-control::placeholder {
    color: rgba(255, 255, 255, .6);
}
body .page-anonymous .card .form-control:focus,
body .page-anonymous .card .form-select:focus {
    color: #fff;
    background-color: rgba(255, 255, 255, .08);
    border-color: #fff;
    box-shadow: 0 0 0 1px #fff;
}
/* the list of "Login source" opens on the system's own (light) menu: dark text there */
body .page-anonymous .card .form-select option {
    color: #1e293b;
    background-color: #fff;
}
/* GLPI turns that list into a select2 (the real <select> is hidden): the same translucent box as the text fields, as tall as
 * they are (52px). Its open list is attached to the page, outside the box, and keeps its own light look. */
body .page-anonymous .card .select2-container--default .select2-selection--single {
    height: 44px;
    background-color: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 12px;
}
body .page-anonymous .card .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0 2.5rem 0 .9rem;
    font-size: 15px;
    line-height: 42px;
    color: #fff;
}
body .page-anonymous .card .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 42px;
    right: .5rem;
}
body .page-anonymous .card .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: rgba(255, 255, 255, .7) transparent transparent;
}
body .page-anonymous .card .select2-container--default.select2-container--open .select2-selection--single,
body .page-anonymous .card .select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #fff;
    box-shadow: 0 0 0 1px #fff;
}
/* the browser's autofill paints a light field of its own: kept translucent, with white text */
body .page-anonymous .card .form-control:-webkit-autofill,
body .page-anonymous .card .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff;
    caret-color: #fff;
    transition: background-color 9999s ease-out 0s;
}

/* "Remember me": a light box; ticked it is white with a navy tick */
body .page-anonymous .card .form-check-input {
    background-color: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .5);
}
body .page-anonymous .card .form-check-input:checked {
    background-color: #fff;
    border-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23002a48' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

/* "Forgotten password?" and the other links of the box */
body .page-anonymous .card a,
body .page-anonymous .card .form-label-description a {
    color: rgba(255, 255, 255, .7);
}
body .page-anonymous .card a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Sign in: the white pill with navy text */
body .page-anonymous .card .btn-primary {
    padding: .6rem 1.5rem;
    font-size: 15px;
    font-weight: 600;
    color: #002a48;
    background-color: #fff;
    border: 0;
    border-radius: 30px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
}
body .page-anonymous .card .btn-primary:hover,
body .page-anonymous .card .btn-primary:focus,
body .page-anonymous .card .btn-primary:active {
    color: #002a48;
    background-color: #eef3f8;
}

/* A wrong login: the translucent red box of the app. GLPI shows it in two places: under the form (alert-danger) and on its own
 * page after a failed login (alert-warning, with a title), where its white box would hide the message (white text on white). */
body .page-anonymous .card .alert-danger,
body .page-anonymous .card .alert-warning {
    color: #fff;
    background-color: rgba(255, 0, 0, .2);
    border: 1px solid #f44336;
    border-radius: 8px;
}
body .page-anonymous .card .alert-warning .alert-title,
body .page-anonymous .card .alert-warning .ti {
    color: #fff;
}
/* any other message in the box (information, success): a neutral translucent one */
body .page-anonymous .card .alert-info,
body .page-anonymous .card .alert-success {
    color: #fff;
    background-color: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 8px;
}
/* GLPI draws the rule with its background (the current color, 1px high), not with a border */
body .page-anonymous .card hr {
    background-color: rgba(255, 255, 255, .24);
    opacity: 1;
}

/* The text at the side of the form (GLPI's login text) and the lines under it */
body .page-anonymous .card .rich_text_container,
body .page-anonymous .card .btn-outline-secondary {
    color: rgba(255, 255, 255, .8);
}
body .page-anonymous .card .btn-outline-secondary {
    border-color: rgba(255, 255, 255, .4);
    border-radius: 30px;
}
body .page-anonymous .container-tight > .text-muted,
body .page-anonymous .container-tight > .text-muted a {
    color: rgba(255, 255, 255, .6) !important;
}

/* ---- The layout of the Interagit apps' login (js/login.js adds body.itg-login-js and the pieces below) ----
 * The labels become the fields' placeholders, the fields get an icon at the left, the password an eye, the "forgotten password?"
 * link goes under the button and the title gets its line "Sign in to continue". Without the script the page keeps the look above. */
body.itg-login-js .page-anonymous .container-tight {
    max-width: 420px;
}
body.itg-login-js .page-anonymous .card .card-header {
    flex-direction: column;
}
body.itg-login-js .page-anonymous .card .card-header h2 {
    margin: .5rem 0 .25rem;
}
body.itg-login-js .page-anonymous .card .card-header .itg-login-sub {
    margin: 0 0 1rem;
    font-size: 14px;
    text-align: center;
    color: rgba(255, 255, 255, .7);
}
body.itg-login-js .page-anonymous .card label.form-label:not(.itg-keep) {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
body.itg-login-js .page-anonymous .card .itg-login-field {
    position: relative;
}
body.itg-login-js .page-anonymous .card #login_name,
body.itg-login-js .page-anonymous .card #login_password {
    padding-left: 3rem;
    background-repeat: no-repeat;
    background-position: .9rem 50%;
    background-size: 22px 22px;
}
body.itg-login-js .page-anonymous .card #login_name {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-opacity='.8' stroke-width='2' stroke-linejoin='round'%3e%3ccircle cx='12' cy='8' r='4'/%3e%3cpath d='M4 21a8 8 0 0 1 16 0'/%3e%3c/svg%3e");
}
body.itg-login-js .page-anonymous .card #login_password {
    padding-right: 3rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-opacity='.8' stroke-width='2' stroke-linejoin='round'%3e%3crect x='5' y='10' width='14' height='10' rx='2'/%3e%3cpath d='M8 10V7a4 4 0 0 1 8 0v3'/%3e%3c/svg%3e");
}
body.itg-login-js .page-anonymous .card #login_name::placeholder,
body.itg-login-js .page-anonymous .card #login_password::placeholder {
    color: rgba(255, 255, 255, .7);
}
body.itg-login-js .page-anonymous .card .itg-login-eye {
    position: absolute;
    top: 50%;
    right: .6rem;
    width: 30px;
    height: 30px;
    padding: 0;
    transform: translateY(-50%);
    cursor: pointer;
    background: transparent no-repeat 50% 50% / 22px 22px;
    border: 0;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-opacity='.8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z'/%3e%3ccircle cx='12' cy='12' r='3'/%3e%3c/svg%3e");
}
body.itg-login-js .page-anonymous .card .itg-login-eye.itg-on {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-opacity='.8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M3 3l18 18'/%3e%3cpath d='M10.6 6.1A10 10 0 0 1 12 5c6.5 0 10 7 10 7a17 17 0 0 1-3 3.8M6.5 6.6C3.7 8.3 2 12 2 12s3.5 7 10 7a9.7 9.7 0 0 0 4-.9'/%3e%3c/svg%3e");
}
body.itg-login-js .page-anonymous .card .mb-3,
body.itg-login-js .page-anonymous .card .mb-4 {
    margin-bottom: .75rem !important;
}
body.itg-login-js .page-anonymous .card .itg-login-forgot {
    margin-top: .75rem;
    font-size: 13px;
    text-align: center;
}

/* The grey explanatory text of the other pages of the box ("Forgotten password?": the line above the field) is made for a white card */
body .page-anonymous .card .text-muted {
    color: rgba(255, 255, 255, .75) !important;
}
body .page-anonymous .container-tight > .text-muted a {
    text-decoration: underline;
}
