// Thinkera sign-in screen (layout/auth.php): sign-in, sign-up, forgotten password, completing the account.
// Phone: a short brand strip, then the form as a white sheet over it. Large screens: brand half and form half.
// Logical properties only, so Arabic and English mirror correctly.

$tk-auth-line: #D5DDE9;
$tk-auth-soft: #F7F9FC;

body.tk-auth-page { background: #fff; }
.tk-auth-page #page.tk-auth-main { background: #fff; min-height: 0; margin: 0; }
#page-wrapper.tk-auth { min-height: 100vh; height: auto; display: flex; flex-direction: column;
    @include media-breakpoint-up(lg) { flex-direction: row; align-items: stretch; } }
.tk-auth > .tk-endofbody { display: contents; }

// ---------------------------------------------------------------- brand side
.tk-auth-brand {
    position: relative; overflow: hidden; color: #fff; padding: 1.25rem 1.25rem 3.25rem;
    background: radial-gradient(circle at 100% 0%, rgba(143, 179, 230, .35), transparent 55%),
                linear-gradient(160deg, $tk-royal 0%, #0C2B58 60%, $tk-navy 100%);
    &::before, &::after {
        content: ""; position: absolute; border-radius: 50%; border: 2px solid rgba(143, 179, 230, .16); pointer-events: none;
    }
    &::before { width: 420px; height: 420px; inset-inline-start: -180px; inset-block-end: -240px; }
    &::after { width: 260px; height: 260px; inset-inline-end: -90px; inset-block-start: -120px; }
    @include media-breakpoint-up(lg) {
        flex: 0 0 46%; min-height: 100vh; padding: 3rem 3.5rem; display: flex; flex-direction: column;
    }
}
.tk-auth-logo { position: relative; z-index: 1; display: inline-flex; align-items: center; min-height: 44px;
    img { height: 32px; width: auto; } }
.tk-auth-pitch {
    position: relative; z-index: 1; margin-top: 1rem;
    h2 { margin: 0; color: #fff; font-size: 1.3rem; font-weight: 700; line-height: 1.5; }
    .tk-auth-pitchlead { display: none; margin: .9rem 0 0; color: #C7D6EA; font-size: 1.05rem; line-height: 1.7; }
    ul { display: none; margin: 1.75rem 0 0; padding: 0; list-style: none; }
    li { position: relative; margin-bottom: .9rem; padding-inline-start: 2.25rem; color: #D7E3F5; font-size: 1.05rem; line-height: 1.6; }
    li::before {
        content: "\2713"; position: absolute; inset-inline-start: 0; inset-block-start: .1rem;
        display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
        background: rgba(143, 179, 230, .22); color: #fff; font-size: .85rem; font-weight: 700;
    }
    @include media-breakpoint-up(lg) {
        margin-top: 4.5rem; max-width: 30rem;
        h2 { font-size: 2.4rem; line-height: 1.35; }
        .tk-auth-pitchlead, ul { display: block; }
    }
}
.tk-auth-jana {
    display: none;
    @include media-breakpoint-up(lg) {
        display: block; position: absolute; z-index: 0; inset-block-end: 0; inset-inline-end: 1.5rem;
        height: 44vh; max-height: 420px; width: auto;
    }
}

// ---------------------------------------------------------------- form side
.tk-auth-main {
    position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; align-items: center;
    margin-top: -1.75rem !important; padding: 1.75rem 1.25rem 1.25rem; background: #fff;
    border-radius: 26px 26px 0 0;
    @include media-breakpoint-up(lg) { margin-top: 0 !important; border-radius: 0; justify-content: center; padding: 3rem; }
}
.tk-auth-card { width: 100%; max-width: 420px; }
// the sign-in footer: the two contact channels and the credit, all down the middle of the column
.tk-auth-foot {
    display: flex; flex-direction: column; align-items: center; gap: .35rem;
    margin-top: auto; padding-top: 2rem; color: $tk-muted; font-size: .875rem; text-align: center;
    @include media-breakpoint-up(lg) { margin-top: 2.5rem; }
}

// the screen draws its own title (layout/auth.php), so the form's own heading goes
#page-login-signup .tk-auth-card :is(.login-heading, [role="main"] > h2),
#page-login-forgot_password .tk-auth-card :is(.login-heading, [role="main"] > h2) { display: none; }
.tk-auth-title, .tk-auth-card h2:first-child {
    margin: 0 0 .3rem; font-size: 1.65rem; font-weight: 700; line-height: 1.35; color: $tk-ink;
}
.tk-auth-lead { margin: 0 0 1.5rem; color: $tk-muted; }
.tk-auth-alert { border-radius: 14px; margin-bottom: 1rem; }

.tk-field { margin-bottom: 1rem;
    label { display: block; margin-bottom: .4rem; font-weight: 600; font-size: .95rem; color: $tk-ink; } }
.tk-field-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    label { margin: 0; }
    a { display: inline-flex; align-items: center; min-height: 44px; font-size: .875rem; font-weight: 600; } }

.tk-auth {
    .form-control, .form-select, .custom-select {
        min-height: 52px; padding-inline: 1rem; border: 1.5px solid $tk-auth-line; border-radius: 14px;
        background-color: $tk-auth-soft; font-size: 16px;
        &:focus { background-color: #fff; border-color: $tk-royal; box-shadow: 0 0 0 4px rgba(17, 57, 114, .12); }
        &.is-invalid { border-color: $tk-bad; }
    }
    .input-group > .form-control { border-start-end-radius: 0; border-end-end-radius: 0; }
    .input-group > .btn { min-height: 52px; border: 1.5px solid $tk-auth-line; border-inline-start: 0;
        border-start-end-radius: 14px; border-end-end-radius: 14px; background: $tk-auth-soft; }
}
.tk-auth-submit {
    width: 100%; min-height: 54px; margin-top: .5rem; border: 0; border-radius: 14px;
    background: $tk-royal; color: #fff; font-weight: 700; font-size: 1.05rem;
    &:hover, &:focus { background: $tk-royal-600; }
}
.tk-auth-secondary {
    display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px;
    border: 1.5px solid $tk-royal; border-radius: 14px; background: #fff; color: $tk-royal; font-weight: 700;
    text-decoration: none;
    &:hover, &:focus { background: #EEF3FB; color: $tk-royal; text-decoration: none; }
}
.tk-auth-new { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid #E6EBF2; text-align: center;
    p { margin: 0 0 .75rem; color: $tk-muted; } }
.tk-auth-providers { display: flex; flex-direction: column; gap: .6rem; }
.tk-auth-provider {
    display: flex; align-items: center; justify-content: center; gap: .6rem; min-height: 52px;
    border: 1.5px solid $tk-auth-line; border-radius: 14px; background: #fff; color: $tk-ink; font-weight: 600;
    text-decoration: none;
    &:hover { background: $tk-auth-soft; color: $tk-ink; text-decoration: none; }
}
.tk-auth-or { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; color: $tk-muted; font-size: .85rem;
    &::before, &::after { content: ""; flex: 1; height: 1px; background: #E6EBF2; } }
.tk-auth-switch { margin: 1.5rem 0 0; text-align: center; color: $tk-muted; a { font-weight: 700; } }

// ---------------------------------------------------------------- Moodle forms on this screen (sign-up, forgotten password, account)
.tk-auth .mform {
    fieldset > legend, .collapsible-actions, .fdescription.required { display: none; }
    .fitem { margin-bottom: 1rem; }
    .fitem > .col-md-3, .fitem > .col-md-9 { flex: 0 0 100%; max-width: 100%; padding: 0; }
    .col-form-label { padding: 0 0 .4rem; font-weight: 600; font-size: .95rem; color: $tk-ink; }
    .col-md-3 .text-danger { display: none; }             // the red "required" marks: every field here is needed
    .form-control-static { font-size: .85rem; color: $tk-muted; }
    .d-flex:has(> .fitem #id_submitbutton) > .fitem { flex: 1 1 100%; margin: .5rem 0 0 !important; }
    #id_submitbutton { width: 100%; min-height: 54px; border-radius: 14px; font-weight: 700; font-size: 1.05rem; }
    #id_cancel { display: none; }
    .fitem_actionbuttons .col-md-9, [data-groupname="buttonar"] .col-md-9 { display: block; }
}
// sign-up: the name on one row; fields filled for the student stay hidden unless they need attention
#page-login-signup .tk-auth form.mform {
    display: grid; grid-template-columns: 1fr 1fr; column-gap: .75rem;
    > * { grid-column: 1 / -1; }
    > #fitem_id_firstname, > #fitem_id_lastname { grid-column: auto; }
}
#page-login-signup .tk-auth :is(#fitem_id_username, #fitem_id_email2, #fitem_id_country):not(:has(.is-invalid)) { display: none; }
#page-login-signup .tk-auth #fitem_id_passwordpolicyinfo { margin-top: -.6rem; }

// labels with a help icon: the icon sits on the label's line, not on a row of its own
.tk-auth .mform .col-form-label { align-items: center; gap: .35rem;
    .form-label-addon { align-self: center !important; }
    .help-icon { min-height: 0; min-width: 0; padding: 0; margin: 0 !important; line-height: 1; } }

// forgotten password: the email only, under the screen's own title (layout/auth.php)
#page-login-forgot_password .tk-auth {
    .generalbox, #id_searchbyusername, .mform hr, .mform fieldset > .d-flex:has(.ftoggler) { display: none; }
    #id_submit { width: 100%; min-height: 54px; border-radius: 14px; font-weight: 700; font-size: 1.05rem; }
    .d-flex:has(> #id_submit) { display: block; }
}
.tk-auth-card:not(:has(form.mform)) .tk-auth-intro { display: none; }
#page-login-forgot_password .tk-auth .mform {
    #id_searchbyemail > .d-flex { display: none !important; }
    fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
}
.tk-auth .mform .fitem.row { margin-inline: 0; }
.tk-auth form.mform { padding-inline: 0 !important; }
.tk-auth .mform .felement > .form-control, .tk-auth .mform .felement > .form-select { flex: 1 1 100%; width: 100%; }

// an icon-only link (the help bubbles on the sign-up form) is still a 44px target
.tk-auth .mform .help-icon {
    display: inline-flex !important; align-items: center; justify-content: center;
    min-inline-size: 44px !important; min-height: 44px !important;   // core sets both to 0 on .btn-link.p-0
}
