/*
 * Shygun login theme, layered on Keycloak's keycloak.v2 (PatternFly 5).
 * Phones/tablets: green polygon header + form in a bottom sheet.
 * Desktop (>= 900px): green brand panel beside a white form.
 * Dark mode follows the device via Keycloak's `pf-v5-theme-dark` class on <html>.
 */

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/vazirmatn/Vazirmatn-Variable.woff2") format("woff2-variations"),
         url("../fonts/vazirmatn/Vazirmatn-Variable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
    --shy-font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
    --shy-brand: #8ab52b;
    --shy-primary: #4f7f0f;
    --shy-primary-hover: #416b0b;
    --shy-on-primary: #ffffff;
    --shy-link: #3f6a08;
    --shy-ring: rgba(79, 127, 15, 0.28);
    --shy-bg: #eef2e6;
    --shy-surface: #ffffff;
    --shy-field: #f7f9f3;
    --shy-fg: #1b2114;
    --shy-muted: #5b6650;
    --shy-line: #d3dac8;
    --shy-panel-1: #6f9a1c;
    --shy-panel-2: #2c4507;
    --shy-radius: 10px;

    /* PatternFly globals resolved through our tokens, so dark mode only swaps --shy-* */
    --pf-v5-global--FontFamily--text: var(--shy-font);
    --pf-v5-global--FontFamily--heading: var(--shy-font);
    --pf-v5-global--FontFamily--text--vf: var(--shy-font);
    --pf-v5-global--FontFamily--heading--vf: var(--shy-font);
    --pf-v5-global--primary-color--100: var(--shy-primary);
    --pf-v5-global--primary-color--200: var(--shy-primary-hover);
    --pf-v5-global--active-color--100: var(--shy-primary);
    --pf-v5-global--link--Color: var(--shy-link);
    --pf-v5-global--link--Color--hover: var(--shy-primary-hover);
    --pf-v5-global--Color--100: var(--shy-fg);
    --pf-v5-global--Color--200: var(--shy-muted);
    --pf-v5-global--BackgroundColor--100: var(--shy-surface);
}

html.pf-v5-theme-dark {
    --shy-primary: #9ccb3b;
    --shy-primary-hover: #b0d95e;
    --shy-on-primary: #142000;
    --shy-link: #b3dc5f;
    --shy-ring: rgba(156, 203, 59, 0.30);
    --shy-bg: #0f130b;
    --shy-surface: #161b12;
    --shy-field: #12160e;
    --shy-fg: #e6ebdd;
    --shy-muted: #a1ac93;
    --shy-line: #323b28;
    --shy-panel-1: #3c5a0c;
    --shy-panel-2: #151f06;
}

/* ---------- Page ---------- */
html.login-pf,
.login-pf body {
    background: var(--shy-bg);
    height: auto;
    min-height: 100%;
}

.login-pf body {
    color: var(--shy-fg);
    font-family: var(--shy-font);
    -webkit-font-smoothing: antialiased;
}

.login-pf :is(input, select, textarea, button) {
    font-family: var(--shy-font);
}

.pf-v5-c-login {
    --pf-v5-c-login__main--BackgroundColor: var(--shy-surface);
    --pf-v5-c-login__main-header--PaddingTop: 20px;
    --pf-v5-c-login__main-header--PaddingRight: 20px;
    --pf-v5-c-login__main-header--PaddingLeft: 20px;
    --pf-v5-c-login__main-header--PaddingBottom: 8px;
    --pf-v5-c-login__main-header--md--PaddingRight: 20px;
    --pf-v5-c-login__main-header--md--PaddingLeft: 20px;
    --pf-v5-c-login__main-body--PaddingRight: 20px;
    --pf-v5-c-login__main-body--PaddingLeft: 20px;
    --pf-v5-c-login__main-body--md--PaddingRight: 20px;
    --pf-v5-c-login__main-body--md--PaddingLeft: 20px;
    --pf-v5-c-login__main-body--PaddingBottom: 8px;
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0;
}

.pf-v5-c-login__container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
}

/* ---------- Brand header (phones: hero) ---------- */
#kc-header.pf-v5-c-login__header {
    margin: 0;
    padding-block: calc(env(safe-area-inset-top, 0px) + 24px) 52px;
    padding-inline: max(20px, env(safe-area-inset-left, 0px)) max(20px, env(safe-area-inset-right, 0px));
    color: #ffffff;
    background:
        linear-gradient(118deg, rgba(255, 255, 255, 0.10) 0 28%, transparent 28.2%),
        linear-gradient(242deg, rgba(0, 0, 0, 0.16) 0 34%, transparent 34.2%),
        linear-gradient(160deg, transparent 0 52%, rgba(255, 255, 255, 0.07) 52.2% 68%, transparent 68.2%),
        linear-gradient(22deg, rgba(0, 0, 0, 0.20) 0 24%, transparent 24.2%),
        linear-gradient(300deg, transparent 0 60%, rgba(255, 255, 255, 0.05) 60.2%),
        linear-gradient(135deg, var(--shy-panel-1), var(--shy-panel-2));
}

#kc-header-wrapper {
    width: 100%;
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    letter-spacing: normal;
    text-transform: none;
    text-align: start;
    white-space: normal;
}

.shy-brand {
    --shy-name-size: 17px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.shy-mark {
    flex: none;
    width: 44px;
    height: 44px;
    background: url("../img/mark.svg") center / contain no-repeat;
}

.shy-name {
    display: inline-grid;
}

.shy-name-title {
    font-size: var(--shy-name-size);
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

/* Tagline sized + justified so it ends exactly where the name ends */
.shy-name-sub {
    font-size: calc(var(--shy-name-size) * 0.82);
    font-weight: 400;
    line-height: 1.25;
    white-space: nowrap;
    text-align: justify;
    text-align-last: justify;
    opacity: 0.92;
}

:lang(en) .shy-name-sub {
    font-size: calc(var(--shy-name-size) * 0.74);
}

.shy-pitch {
    margin-top: 20px;
}

.shy-pitch-title {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.45;
    text-wrap: balance;
}

.shy-pitch-sub,
.shy-points {
    display: none;
}

/* ---------- Form sheet ---------- */
.pf-v5-c-login__main {
    position: relative;
    flex: 1;
    width: 100%;
    margin: -28px 0 0;
    padding-block: 14px calc(24px + env(safe-area-inset-bottom, 0px));
    border-radius: 24px 24px 0 0;
    box-shadow: none;
    background: var(--shy-surface);
}

.pf-v5-c-login__main::before {
    content: "";
    position: absolute;
    top: 9px;
    left: 50%;
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background: var(--shy-line);
    transform: translateX(-50%);
}

.login-pf div.pf-v5-c-login__main-header {
    grid-template-columns: minmax(0, 1fr) auto;
    border-top: 0;
}

#kc-page-title {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.4;
    text-wrap: balance;
}

/* Language switcher: compact pill */
.login-pf .pf-v5-c-login__main-header-utilities .pf-v5-c-form-control {
    --pf-v5-c-form-control--FontSize: 13px;
    min-height: 36px;
    border-radius: 999px;
    font-weight: 600;
}

/* Flags (used by the language menu, and by the native select when JavaScript is off) */
:root { --shy-flag-en: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3CclipPath id='t'%3E%3Cpath d='M30 15h30v15zv15H0zH0V0zV0h30z'/%3E%3C/clipPath%3E%3Cpath d='M0 0v30h60V0z' fill='%23012169'/%3E%3Cpath d='M0 0l60 30m0-30L0 30' stroke='%23fff' stroke-width='6'/%3E%3Cpath d='M0 0l60 30m0-30L0 30' clip-path='url(%23t)' stroke='%23C8102E' stroke-width='4'/%3E%3Cpath d='M30 0v30M0 15h60' stroke='%23fff' stroke-width='10'/%3E%3Cpath d='M30 0v30M0 15h60' stroke='%23C8102E' stroke-width='6'/%3E%3C/svg%3E");
    --shy-flag-fa: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 21 12'%3E%3Cpath fill='%23239f40' d='M0 0h21v4H0z'/%3E%3Cpath fill='%23fff' d='M0 4h21v4H0z'/%3E%3Cpath fill='%23da0000' d='M0 8h21v4H0z'/%3E%3C/svg%3E"); }
html[lang^="en"] { --shy-flag: var(--shy-flag-en); }
html[lang^="fa"] { --shy-flag: var(--shy-flag-fa); }

/* ---------- Language menu (built by js/shygun-locale.js) ---------- */
.pf-v5-c-login__main-header-utilities [hidden] {
    display: none !important;
}

.shy-lang {
    position: relative;
}

/* Light/dark switch (js/shygun-theme.js), in front of the language menu */
.pf-v5-c-login__main-header-utilities {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shy-theme-btn {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--shy-line);
    border-radius: 999px;
    background: var(--shy-field);
    color: var(--shy-fg);
    line-height: 0;
    cursor: pointer;
}

.shy-theme-btn:hover {
    border-color: var(--shy-primary);
}

.shy-theme-btn:focus-visible {
    outline: none;
    border-color: var(--shy-primary);
    box-shadow: 0 0 0 3px var(--shy-ring);
}

.shy-theme-btn svg {
    display: block;
    width: 18px;
    height: 18px;
}

/* Shows what a press switches to: the moon in light mode, the sun in dark mode */
.shy-theme-sun,
html.pf-v5-theme-dark .shy-theme-moon {
    display: none !important;
}

html.pf-v5-theme-dark .shy-theme-sun {
    display: block !important;
}

.shy-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding-inline: 14px 12px;
    border: 1px solid var(--shy-line);
    border-radius: 999px;
    background: var(--shy-field);
    color: var(--shy-fg);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.shy-lang-btn:hover,
.shy-lang-btn[aria-expanded="true"] {
    border-color: var(--shy-primary);
}

.shy-lang-btn:focus-visible {
    outline: none;
    border-color: var(--shy-primary);
    box-shadow: 0 0 0 3px var(--shy-ring);
}

.shy-lang-caret {
    width: 14px;
    height: 14px;
    color: var(--shy-muted);
}

.shy-lang-btn[aria-expanded="true"] .shy-lang-caret {
    transform: rotate(180deg);
}

.shy-flag {
    flex: none;
    width: 20px;
    height: 13px;
    border-radius: 2px;
    background: center / cover no-repeat;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.shy-flag[data-lang="en"] { background-image: var(--shy-flag-en); }
.shy-flag[data-lang="fa"] { background-image: var(--shy-flag-fa); }

.shy-lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-end: 0;
    z-index: 20;
    min-width: 168px;
    margin: 0;
    padding: 6px;
    list-style: none;
    border: 1px solid var(--shy-line);
    border-radius: 12px;
    background: var(--shy-surface);
    box-shadow: 0 10px 30px rgba(20, 32, 0, 0.14);
}

.shy-lang-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding-inline: 10px;
    border-radius: 8px;
    color: var(--shy-fg) !important;
    font-size: 14px;
    font-weight: 500 !important;
    text-decoration: none;
}

.shy-lang-item:hover,
.shy-lang-item:focus-visible {
    outline: none;
    background: var(--shy-field);
}

.shy-lang-item[aria-current="true"] {
    background: color-mix(in srgb, var(--shy-primary) 12%, transparent);
    color: var(--shy-link) !important;
    font-weight: 700 !important;
}

.shy-lang-item[aria-current="true"]::after {
    content: "";
    width: 14px;
    height: 14px;
    margin-inline-start: auto;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

@media (prefers-reduced-motion: no-preference) {
    .shy-lang-caret {
        transition: transform 0.15s ease;
    }
}

.login-pf .pf-v5-c-login__main-header-utilities .pf-v5-c-form-control {
    overflow: hidden;
    background: var(--shy-field);
}

.login-pf .pf-v5-c-login__main-header-utilities .pf-v5-c-form-control > select {
    min-height: 34px;
    padding-block: 0;
    padding-inline: 40px 30px;
    background: var(--shy-flag) no-repeat left 14px center / 20px 13px;
    border-radius: 999px;
    cursor: pointer;
}

html[dir="rtl"] .pf-v5-c-login__main-header-utilities .pf-v5-c-form-control > select {
    background-position: right 14px center;
}

.login-pf .pf-v5-c-login__main-header-utilities .pf-v5-c-form-control__utilities {
    padding-inline-end: 12px;
}

/* Tablets: keep the sheet a comfortable width */
@media (min-width: 600px) and (max-width: 899.98px) {
    #kc-header-wrapper,
    .pf-v5-c-login__main {
        max-width: 560px;
        margin-inline: auto;
    }

    .pf-v5-c-login__main {
        margin-top: -28px;
    }
}

/* ---------- Desktop: brand panel + form ---------- */
@media (min-width: 900px) {
    .pf-v5-c-login__container {
        display: grid;
        grid-template-columns: minmax(360px, 42%) minmax(0, 1fr);
        grid-template-rows: 1fr;
        grid-template-areas: "header main";
        column-gap: 0;
        justify-content: stretch;
        padding: 0;
    }

    #kc-header.pf-v5-c-login__header {
        grid-area: header;
        position: sticky;
        top: 0;
        height: 100vh;
        height: 100dvh;
        display: flex;
        padding: 48px clamp(32px, 4vw, 64px);
    }

    #kc-header-wrapper {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .shy-brand {
        --shy-name-size: 20px;
    }

    .shy-mark {
        width: 52px;
        height: 52px;
    }

    .shy-pitch {
        display: flex;
        flex-direction: column;
        flex: 1;
        margin-top: 0;
    }

    .shy-pitch-title {
        margin-top: auto;
        max-width: 15ch;
        font-size: clamp(28px, 2.6vw, 36px);
        line-height: 1.35;
    }

    .shy-pitch-sub {
        display: block;
        margin-top: 12px;
        max-width: 36ch;
        font-size: 15px;
        opacity: 0.88;
    }

    .shy-points {
        display: grid;
        gap: 12px;
        margin-top: auto;
        padding-top: 40px;
        font-size: 14px;
    }

    .shy-point {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .shy-point::before {
        content: "";
        flex: none;
        width: 20px;
        height: 20px;
        background: currentColor;
        -webkit-mask: var(--shy-icon) center / contain no-repeat;
        mask: var(--shy-icon) center / contain no-repeat;
        opacity: 0.9;
    }

    .shy-point-shield {
        --shy-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
    }

    .shy-point-phone {
        --shy-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='6' y='2' width='12' height='20' rx='2'/%3E%3Cpath d='M11 18h2'/%3E%3C/svg%3E");
    }

    .pf-v5-c-login__main {
        grid-area: main;
        align-self: stretch;
        display: flex;
        flex-direction: column;
        justify-content: center;
        margin: 0;
        padding: 48px clamp(24px, 5vw, 72px);
        border-radius: 0;
    }

    .pf-v5-c-login__main::before {
        display: none;
    }

    .pf-v5-c-login__main > * {
        width: 100%;
        max-width: 420px;
        margin-inline: auto;
    }

    .pf-v5-c-login {
        --pf-v5-c-login__main-header--PaddingTop: 0;
        --pf-v5-c-login__main-header--PaddingRight: 0;
        --pf-v5-c-login__main-header--PaddingLeft: 0;
        --pf-v5-c-login__main-header--md--PaddingRight: 0;
        --pf-v5-c-login__main-header--md--PaddingLeft: 0;
        --pf-v5-c-login__main-body--PaddingRight: 0;
        --pf-v5-c-login__main-body--PaddingLeft: 0;
        --pf-v5-c-login__main-body--md--PaddingRight: 0;
        --pf-v5-c-login__main-body--md--PaddingLeft: 0;
    }

    .pf-v5-c-login__main-header {
        padding-bottom: 12px;
    }

    #kc-page-title {
        font-size: 24px;
    }
}

/* ---------- One vertical rhythm for forms ---------- */
.login-pf .pf-v5-c-form {
    --pf-v5-c-form--GridGap: 18px;
}

.login-pf .pf-v5-c-login__main-header {
    padding-bottom: 18px;
}

.login-pf .pf-v5-c-form__group:has(> .pf-v5-c-form__actions) {
    margin-top: 2px;
}

.login-pf .pf-v5-c-login__main-footer > :first-child {
    margin-top: 0;
}

/* Keycloak's hidden helper input would otherwise take a grid gap of its own */
.login-pf .pf-v5-c-form > #id-hidden-input,
.login-pf .pf-v5-c-form > input[type="hidden"] {
    display: none;
}

/* Language pill sits above the title, at the end of the row, so titles get the full width */
.login-pf div.pf-v5-c-login__main-header {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 10px;
}

.login-pf .pf-v5-c-login__main-header-utilities {
    grid-row: 1;
    grid-column: 1;
    justify-self: end;
}

.login-pf .pf-v5-c-login__main-header > #kc-page-title {
    grid-row: 2;
    grid-column: 1;
}

/* Buttons: no extra space above the first one; stacked buttons 10px apart */
.login-pf .pf-v5-c-form__actions {
    --pf-v5-c-form__actions--MarginTop: 0;
    --pf-v5-c-form__actions--MarginRight: 0;
    --pf-v5-c-form__actions--MarginBottom: 0;
    --pf-v5-c-form__actions--MarginLeft: 0;
    --pf-v5-c-form__actions--child--MarginTop: 0;
    --pf-v5-c-form__actions--child--MarginRight: 0;
    --pf-v5-c-form__actions--child--MarginBottom: 0;
    --pf-v5-c-form__actions--child--MarginLeft: 0;
    gap: 10px;
    padding-top: 0 !important;
}

/* ---------- Form controls ---------- */
.login-pf .pf-v5-c-form__label,
.login-pf .pf-v5-c-form__label-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--shy-fg);
}

.login-pf .pf-v5-c-form-control {
    --pf-v5-c-form-control--BackgroundColor: var(--shy-field);
    --pf-v5-c-form-control--Color: var(--shy-fg);
    --pf-v5-c-form-control--FontSize: 16px;
    --pf-v5-c-form-control--PaddingRight: 12px;
    --pf-v5-c-form-control--PaddingLeft: 12px;
    --pf-v5-c-form-control--before--BorderTopColor: var(--shy-line);
    --pf-v5-c-form-control--before--BorderRightColor: var(--shy-line);
    --pf-v5-c-form-control--before--BorderBottomColor: var(--shy-line);
    --pf-v5-c-form-control--before--BorderLeftColor: var(--shy-line);
    --pf-v5-c-form-control--before--BorderBottomWidth: 1px;
    --pf-v5-c-form-control--after--BorderBottomWidth: 0;
    --pf-v5-c-form-control--hover--after--BorderBottomColor: transparent;
    --pf-v5-c-form-control--focus--after--BorderBottomWidth: 0;
    --pf-v5-c-form-control--m-readonly--BackgroundColor: var(--shy-bg);
    min-height: 46px;
    border-radius: var(--shy-radius);
}

.login-pf .pf-v5-c-form-control::before,
.login-pf .pf-v5-c-form-control::after {
    border-radius: inherit;
}

/* Centre the text, the error icon and the dropdown arrow vertically in every field */
.login-pf .pf-v5-c-form-control {
    align-items: center;
}

.login-pf .pf-v5-c-form-control > :is(input, select) {
    align-self: stretch;
    padding-block: 0;
    line-height: normal;
}

.login-pf .pf-v5-c-form-control__utilities,
.login-pf .pf-v5-c-form-control__icon,
.login-pf .pf-v5-c-form-control__toggle-icon {
    display: flex;
    align-items: center;
    align-self: center;
    padding-block: 0;
}

.login-pf .pf-v5-c-form-control__utilities svg,
.login-pf .pf-v5-c-form-control__icon i {
    vertical-align: middle;
}

/* Link buttons (e.g. "Back to sign in") centre their text like real buttons */
.login-pf a.pf-v5-c-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.login-pf a.pf-v5-c-button.pf-m-block {
    display: flex;
}

/* Whole-form messages (errors, "code sent", "email sent") go at the top of the form */
.login-pf .pf-v5-c-login__main-body {
    display: flex;
    flex-direction: column;
}

.login-pf .pf-v5-c-login__main-body > .pf-v5-c-alert {
    order: -1;
}

.login-pf .pf-v5-c-form-control:hover {
    --pf-v5-c-form-control--before--BorderTopColor: var(--shy-muted);
    --pf-v5-c-form-control--before--BorderRightColor: var(--shy-muted);
    --pf-v5-c-form-control--before--BorderBottomColor: var(--shy-muted);
    --pf-v5-c-form-control--before--BorderLeftColor: var(--shy-muted);
}

.login-pf .pf-v5-c-form-control:focus-within {
    --pf-v5-c-form-control--before--BorderTopColor: var(--shy-primary);
    --pf-v5-c-form-control--before--BorderRightColor: var(--shy-primary);
    --pf-v5-c-form-control--before--BorderBottomColor: var(--shy-primary);
    --pf-v5-c-form-control--before--BorderLeftColor: var(--shy-primary);
    box-shadow: 0 0 0 3px var(--shy-ring);
}

.login-pf .pf-v5-c-form-control.pf-m-error {
    --pf-v5-c-form-control--before--BorderTopColor: var(--pf-v5-global--danger-color--100);
    --pf-v5-c-form-control--before--BorderRightColor: var(--pf-v5-global--danger-color--100);
    --pf-v5-c-form-control--before--BorderBottomColor: var(--pf-v5-global--danger-color--100);
    --pf-v5-c-form-control--before--BorderLeftColor: var(--pf-v5-global--danger-color--100);
}

.login-pf .pf-v5-c-form-control > :is(input, select, textarea) {
    min-height: 44px;
}

/* Values that are always Latin: usernames, emails, passwords, phone numbers, codes */
.login-pf :where(#username, #password, #password-new, #password-confirm, #email, #kc-attempted-username,
    #loginInput, #mobileNumber, #emailAddress, #entered_mobile_number,
    input[type="email"], input[type="tel"], input[type="password"], input[inputmode="numeric"]) {
    direction: ltr;
    text-align: left;
}

/* In Persian these Latin values still start at the right, in line with the label and away from the eye button */
html[dir="rtl"] :where(#username, #password, #password-new, #password-confirm, #email, #kc-attempted-username,
    #loginInput, #mobileNumber, #emailAddress, #entered_mobile_number,
    input[type="email"], input[type="tel"], input[type="password"]) {
    text-align: right;
}

/* In Persian the error icon sits on the left, where left-to-right text starts: make room for it */
html[dir="rtl"] .pf-v5-c-form-control:has(> .pf-v5-c-form-control__utilities) > input {
    padding-left: 36px;
}

.phone-mask,
.shy-ltr {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
}

/* Password field + eye button read as one field */
.login-pf .pf-v5-c-input-group > .pf-v5-c-input-group__item:first-child:not(:last-child) .pf-v5-c-form-control {
    border-start-end-radius: 0;
    border-end-end-radius: 0;
}

.login-pf .pf-v5-c-input-group > .pf-v5-c-input-group__item:not(:first-child) .pf-v5-c-button,
.login-pf .pf-v5-c-input-group > .pf-v5-c-input-group__item:not(:first-child) .pf-v5-c-button::after {
    border-start-start-radius: 0;
    border-end-start-radius: 0;
    border-start-end-radius: var(--shy-radius);
    border-end-end-radius: var(--shy-radius);
}

.login-pf .pf-v5-c-button.pf-m-control {
    --pf-v5-c-button--m-control--BackgroundColor: var(--shy-field);
    --pf-v5-c-button--m-control--Color: var(--shy-muted);
    --pf-v5-c-button--m-control--after--BorderTopColor: var(--shy-line);
    --pf-v5-c-button--m-control--after--BorderRightColor: var(--shy-line);
    --pf-v5-c-button--m-control--after--BorderBottomColor: var(--shy-line);
    --pf-v5-c-button--m-control--after--BorderLeftColor: var(--shy-line);
    --pf-v5-c-button--m-control--hover--after--BorderBottomColor: var(--shy-primary);
    min-width: 46px;
    min-height: 46px;
}

/* Checkboxes and radios */
.login-pf input[type="checkbox"],
.login-pf input[type="radio"] {
    accent-color: var(--shy-primary);
    width: 18px;
    height: 18px;
}

/* ---------- Buttons ---------- */
.login-pf .pf-v5-c-button {
    --pf-v5-c-button--BorderRadius: var(--shy-radius);
    --pf-v5-c-button--FontWeight: 600;
}

.login-pf .pf-v5-c-button:is(.pf-m-primary, .pf-m-secondary) {
    min-height: 46px;
    font-size: 15px;
}

.login-pf .pf-v5-c-button.pf-m-primary {
    --pf-v5-c-button--m-primary--BackgroundColor: var(--shy-primary);
    --pf-v5-c-button--m-primary--hover--BackgroundColor: var(--shy-primary-hover);
    --pf-v5-c-button--m-primary--focus--BackgroundColor: var(--shy-primary-hover);
    --pf-v5-c-button--m-primary--active--BackgroundColor: var(--shy-primary-hover);
    --pf-v5-c-button--m-primary--Color: var(--shy-on-primary);
    --pf-v5-c-button--m-primary--hover--Color: var(--shy-on-primary);
    --pf-v5-c-button--m-primary--focus--Color: var(--shy-on-primary);
    --pf-v5-c-button--m-primary--active--Color: var(--shy-on-primary);
    font-weight: 700;
}

.login-pf .pf-v5-c-button.pf-m-secondary {
    --pf-v5-c-button--m-secondary--BackgroundColor: var(--shy-surface);
    --pf-v5-c-button--m-secondary--Color: var(--shy-fg);
    --pf-v5-c-button--m-secondary--hover--Color: var(--shy-fg);
    --pf-v5-c-button--m-secondary--focus--Color: var(--shy-fg);
    --pf-v5-c-button--m-secondary--active--Color: var(--shy-fg);
    --pf-v5-c-button--m-secondary--after--BorderColor: var(--shy-line);
    --pf-v5-c-button--m-secondary--hover--after--BorderColor: var(--shy-primary);
    --pf-v5-c-button--m-secondary--focus--after--BorderColor: var(--shy-primary);
    --pf-v5-c-button--m-secondary--active--after--BorderColor: var(--shy-primary);
}

.login-pf .pf-v5-c-button.pf-m-link {
    --pf-v5-c-button--m-link--Color: var(--shy-link);
    --pf-v5-c-button--m-link--hover--Color: var(--shy-primary-hover);
    font-weight: 600;
}

.login-pf .pf-v5-c-button.pf-m-link:disabled {
    color: var(--shy-muted);
}

.login-pf a {
    color: var(--shy-link);
    font-weight: 600;
}

.login-pf a:hover {
    color: var(--shy-primary-hover);
}

.login-pf :is(a, button, .pf-v5-c-button):focus-visible {
    outline: 2px solid var(--shy-primary);
    outline-offset: 2px;
}

/* Fields show focus on their rounded box (border + soft ring), not a second square outline */
.login-pf .pf-v5-c-form-control > :is(input, select, textarea):focus,
.login-pf .pf-v5-c-form-control > :is(input, select, textarea):focus-visible {
    outline: none;
}

.login-pf .pf-v5-c-form__actions {
    margin-top: 0;
    padding-top: 0;
}

/* ---------- Social login ---------- */
/* "Or sign in with" becomes a divider: line, text, line */
.login-pf .pf-v5-c-login__main-footer-band:has(+ #kc-social-providers) {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-block: 20px 4px;
    padding: 0;
    border-top: 0;
    font-size: 13px;
}

.login-pf .pf-v5-c-login__main-footer-band:has(+ #kc-social-providers)::before,
.login-pf .pf-v5-c-login__main-footer-band:has(+ #kc-social-providers)::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--shy-line);
}

#kc-social-providers .pf-v5-c-login__main-body {
    padding-block: 8px 0;
}

#kc-social-providers .pf-v5-c-button {
    justify-content: center !important;
    gap: 10px;
}

#kc-social-providers .pf-v5-c-button .kc-social-provider-name {
    margin: 0 !important;
}

/* ---------- Info, alerts, helpers ---------- */
.login-pf .pf-v5-c-login__main-footer-band {
    border-top: 0;
    color: var(--shy-muted);
    text-align: center;
}

.login-pf #kc-info.pf-v5-c-login__main-footer-band {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--shy-line);
}

.login-pf .pf-v5-c-alert {
    border-radius: var(--shy-radius);
}

.login-pf .pf-v5-c-alert__title {
    font-weight: 600;
}

.login-pf .subtitle,
.login-pf .pf-v5-c-helper-text {
    color: var(--shy-muted);
}

/* Restart-login tooltip, mirrored for right-to-left */
.kc-login-tooltip .kc-tooltip-text {
    left: auto;
    inset-inline-start: 160%;
    font-size: 12px;
}

[dir="rtl"] .kc-login-tooltip .kc-tooltip-text::after {
    right: auto;
    left: 100%;
    border-color: transparent transparent transparent black;
}

/* Breathing room under plain paragraphs (sign-out question, info pages) */
.login-pf .pf-v5-c-login__main-body p:not(.shy-lead) {
    margin-bottom: 16px;
    line-height: 1.8;
}

/* ---------- Shygun custom screens ---------- */
.shy-lead {
    margin: 0 0 4px;
    color: var(--shy-muted);
    font-size: 14px;
    line-height: 1.8;
}

.shy-lead strong {
    color: var(--shy-fg);
}

/* "Registered email/number: t***@e***.test" shown as a small chip under the instruction */
.shy-registered {
    display: inline-flex;
    align-self: center;
    justify-self: center;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--shy-field);
    border: 1px solid var(--shy-line);
    color: var(--shy-muted);
    font-size: 13px;
}

.shy-registered strong {
    color: var(--shy-fg);
    font-weight: 700;
}

/* SMS code: one field, large spaced digits, number keypad */
.login-pf input.shy-otp {
    direction: ltr;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.45em;
    text-align: center;
    font-variant-numeric: tabular-nums;
    padding-inline-start: 0.45em;
}

.shy-resend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    color: var(--shy-muted);
}

.shy-timer {
    direction: ltr;
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
}

/* Verification method choices as selectable cards */
.shy-methods {
    display: grid;
    gap: 10px;
    border: 0;
    margin: 0;
    padding: 0;
}

.shy-method {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 12px 14px;
    border: 1px solid var(--shy-line);
    border-radius: var(--shy-radius);
    background: var(--shy-field);
    cursor: pointer;
}

.shy-method:has(input:checked) {
    border-color: var(--shy-primary);
    box-shadow: 0 0 0 3px var(--shy-ring);
}

.shy-method input {
    flex: none;
    margin: 0;
}

.shy-method-text {
    display: grid;
    gap: 2px;
    font-size: 14px;
}

.shy-method-text strong {
    font-weight: 700;
}

.shy-method-text span {
    color: var(--shy-muted);
}

/* Account details summary */
.shy-account {
    display: grid;
    margin: 4px 0 0;
    border: 1px solid var(--shy-line);
    border-radius: var(--shy-radius);
    background: var(--shy-field);
}

.shy-account div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    font-size: 14px;
}

.shy-account div + div {
    border-top: 1px solid var(--shy-line);
}

.shy-account dt {
    color: var(--shy-muted);
}

.shy-account dd {
    margin: 0;
    font-weight: 700;
    text-align: end;
    overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: no-preference) {
    .login-pf .pf-v5-c-button,
    .login-pf .pf-v5-c-form-control,
    .shy-method {
        transition: box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
    }
}
