/* ===========================================================================
   HDR HR - sign-in page
   ---------------------------------------------------------------------------
   The old page put the account type behind a plain <select> labelled "Login
   As", defaulting to Admin. Nothing on screen said what the choice changed, so
   picking Employee for an account that also has an admin login silently landed
   you on a near-empty dashboard. That choice is now three visible cards, each
   saying what it gives you, rather than a collapsed dropdown.

   Direction-agnostic (logical properties) because the panel runs in Arabic,
   and theme-aware via the same tokens as hdr-dashboard.css.
   =========================================================================== */

:root {
    --auth-bg: #eef2f8;
    --auth-card: #ffffff;
    --auth-border: #e3e9f2;
    --auth-text: #0f172a;
    --auth-muted: #64748b;
    --auth-brand: #0f2a4a;
    --auth-brand-2: #1e4b7a;
    --auth-accent: #2563eb;
    --auth-accent-soft: #eff6ff;
    --auth-danger: #e11d48;
    --auth-danger-soft: #fff1f2;
    --auth-ring: rgba(37, 99, 235, .18);
}

:root[data-theme="dark"] {
    --auth-bg: #0b1120;
    --auth-card: #131a2b;
    --auth-border: #1f2a41;
    --auth-text: #e8eefc;
    --auth-muted: #94a3b8;
    --auth-brand: #0b1526;
    --auth-brand-2: #16304f;
    --auth-accent: #60a5fa;
    --auth-accent-soft: rgba(96, 165, 250, .12);
    --auth-danger: #fb7185;
    --auth-danger-soft: rgba(251, 113, 133, .12);
    --auth-ring: rgba(96, 165, 250, .25);
}

body.hdr-auth {
    background: var(--auth-bg) !important;
    color: var(--auth-text);
    min-block-size: 100vh;
}

.hdr-auth-page {
    min-block-size: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
}

.hdr-auth-card {
    inline-size: min(980px, 100%);
    background: var(--auth-card);
    border: 1px solid var(--auth-border);
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 24px 48px rgba(16, 24, 40, .10);
    overflow: hidden;
    display: grid;
    grid-template-columns: 5fr 7fr;
}

/* ---------------------------------------------------------------------------
   Brand panel
--------------------------------------------------------------------------- */
.hdr-auth-brand {
    background: linear-gradient(155deg, var(--auth-brand) 0%, var(--auth-brand-2) 100%);
    padding: 2.75rem 2.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    position: relative;
    isolation: isolate;
}

/* Soft light bloom, purely decorative. */
.hdr-auth-brand::after {
    content: "";
    position: absolute;
    inset-block-start: -30%;
    inset-inline-end: -25%;
    inline-size: 70%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .14), transparent 70%);
    z-index: -1;
}

.hdr-auth-brand .brand-logo {
    display: block;
    inline-size: auto;
    max-inline-size: 100%;
    max-block-size: 92px;
    object-fit: contain;
    /* Company wordmarks are dark on transparent; on this deep panel they need
       to be knocked out to white. */
    filter: brightness(0) invert(1);
}

.hdr-auth-brand .brand-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.01em;
    margin: 0;
}

.hdr-auth-brand .brand-tag {
    color: rgba(255, 255, 255, .72);
    font-size: .9rem;
    line-height: 1.6;
    margin: .5rem 0 0;
}

/* ---------------------------------------------------------------------------
   Form panel
--------------------------------------------------------------------------- */
.hdr-auth-form {
    padding: 2.75rem 2.5rem;
}

.hdr-auth-form h1 {
    font-size: 1.5rem;
    font-weight: 680;
    letter-spacing: -.02em;
    color: var(--auth-text);
    margin: 0 0 .35rem;
}

.hdr-auth-form .lede {
    color: var(--auth-muted);
    font-size: .93rem;
    margin: 0 0 1.75rem;
}

.hdr-field {
    margin-block-end: 1.15rem;
}

.hdr-field > label,
.hdr-fieldset > legend {
    display: block;
    font-size: .8rem;
    font-weight: 620;
    color: var(--auth-text);
    margin-block-end: .5rem;
    letter-spacing: -.005em;
}

.hdr-fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 1.5rem;
}

.hdr-fieldset > legend {
    float: none;
    inline-size: auto;
    font-size: .8rem;
}

.hdr-fieldset .hint {
    font-weight: 400;
    color: var(--auth-muted);
    font-size: .78rem;
    margin-block-end: .6rem;
}

/* Account-type chooser --------------------------------------------------- */
.hdr-roles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .6rem;
}

.hdr-role input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.hdr-role label {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    block-size: 100%;
    padding: .85rem .8rem;
    border: 1.5px solid var(--auth-border);
    border-radius: 12px;
    cursor: pointer;
    background: var(--auth-card);
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.hdr-role label:hover {
    border-color: color-mix(in srgb, var(--auth-accent) 45%, var(--auth-border));
}

.hdr-role .role-name {
    font-size: .86rem;
    font-weight: 640;
    color: var(--auth-text);
    line-height: 1.25;
}

.hdr-role .role-hint {
    font-size: .72rem;
    color: var(--auth-muted);
    line-height: 1.35;
}

.hdr-role input:checked + label {
    border-color: var(--auth-accent);
    background: var(--auth-accent-soft);
    box-shadow: 0 0 0 3px var(--auth-ring);
}

.hdr-role input:checked + label .role-name {
    color: var(--auth-accent);
}

/* Keyboard users must still get a visible focus ring on the hidden radio. */
.hdr-role input:focus-visible + label {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

/* Inputs ------------------------------------------------------------------ */
.hdr-auth-form .form-control {
    inline-size: 100%;
    padding: .7rem .85rem;
    font-size: .95rem;
    color: var(--auth-text);
    background: var(--auth-card) !important;
    border: 1.5px solid var(--auth-border) !important;
    border-radius: 11px !important;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.hdr-auth-form .form-control::placeholder {
    color: color-mix(in srgb, var(--auth-muted) 70%, transparent);
}

.hdr-auth-form .form-control:focus {
    border-color: var(--auth-accent) !important;
    box-shadow: 0 0 0 3px var(--auth-ring) !important;
    outline: none;
}

.hdr-auth-form .form-control.is-invalid {
    border-color: var(--auth-danger) !important;
}

.hdr-password {
    position: relative;
}

/* Sits inside the field on the trailing edge, which flips under RTL. */
.hdr-password .toggle {
    position: absolute;
    inset-inline-end: .5rem;
    inset-block-start: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    inline-size: 34px;
    block-size: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
}

.hdr-password .toggle:hover {
    background: var(--auth-accent-soft);
    color: var(--auth-accent);
}

.hdr-password .form-control {
    padding-inline-end: 2.75rem;
}

/* Actions ----------------------------------------------------------------- */
.hdr-auth-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-block-start: 1.6rem;
}

.hdr-btn-signin {
    flex: 1;
    padding: .78rem 1.25rem;
    font-size: .95rem;
    font-weight: 640;
    color: #fff;
    background: var(--auth-accent);
    border: 0;
    border-radius: 11px;
    cursor: pointer;
    transition: background-color .15s ease, transform .12s ease, box-shadow .15s ease;
}

.hdr-btn-signin:hover {
    background: color-mix(in srgb, var(--auth-accent) 88%, #000);
    box-shadow: 0 8px 20px var(--auth-ring);
}

.hdr-btn-signin:active {
    transform: translateY(1px);
}

.hdr-auth-actions a {
    color: var(--auth-muted);
    font-size: .86rem;
    text-decoration: none;
    white-space: nowrap;
}

.hdr-auth-actions a:hover {
    color: var(--auth-accent);
    text-decoration: underline;
}

/* Alerts ------------------------------------------------------------------ */
.hdr-auth-alert {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .8rem .95rem;
    border-radius: 11px;
    font-size: .88rem;
    margin-block-end: 1.25rem;
    background: var(--auth-danger-soft);
    color: var(--auth-danger);
    border: 1px solid color-mix(in srgb, var(--auth-danger) 28%, transparent);
}

.hdr-field-error {
    display: block;
    color: var(--auth-danger);
    font-size: .78rem;
    margin-block-start: .35rem;
}

/* ---------------------------------------------------------------------------
   Responsive: the brand panel becomes a slim header rather than disappearing,
   so the company is still identified on a phone.
--------------------------------------------------------------------------- */
@media (max-width: 860px) {
    .hdr-auth-card {
        grid-template-columns: 1fr;
    }

    .hdr-auth-brand {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 1rem;
        padding: 1.5rem;
    }

    .hdr-auth-brand .brand-logo {
        max-block-size: 46px;
    }

    .hdr-auth-brand .brand-tag {
        display: none;
    }

    .hdr-auth-form {
        padding: 1.75rem 1.35rem;
    }

    .hdr-roles {
        grid-template-columns: 1fr;
    }

    .hdr-role label {
        flex-direction: row;
        align-items: baseline;
        gap: .5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hdr-role label,
    .hdr-auth-form .form-control,
    .hdr-btn-signin {
        transition: none !important;
    }

    .hdr-btn-signin:active {
        transform: none;
    }
}
