/* ══════════════════════════════════════════════════════════════════
   LOGIN PAGE — GRDF TraitDoc
   Applied by GRDF.CustomLogin (subclass of %CSP.Login)
   Two-column split: architectural photo left · branded card right
══════════════════════════════════════════════════════════════════ */

/* ── Design tokens ─────────────────────────────────────────────── */
:root {
    --clr-primary:        #1a4f8a;   /* GRDF deep navy blue           */
    --clr-primary-hover:  #14407a;
    --clr-primary-glow:   rgba(26, 79, 138, 0.18);
    --clr-bg:             #f0f4f8;   /* very light blue-grey           */
    --clr-card:           #ffffff;
    --clr-text:           #1f2937;
    --clr-label:          #374151;
    --clr-muted:          #9ca3af;
    --clr-border:         #d1d9e0;
    --clr-input-bg:       #f9fafb;
    --clr-required:       #e53e3e;
    --clr-error-bg:       #fef2f2;
    --clr-error-border:   #fca5a5;
    --clr-error-text:     #b91c1c;
    --clr-divider:        #e5eaf0;

    --radius-card:        18px;
    --radius-input:       9px;
    --radius-btn:         50px;

    --shadow-card:        0 8px 48px rgba(0, 0, 0, 0.12),
                          0 2px 12px rgba(0, 0, 0, 0.06);
    --shadow-btn-hover:   0 6px 22px rgba(26, 79, 138, 0.35);

    --font-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 'Helvetica Neue', Arial, sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: var(--font-base);
    background: var(--clr-bg);
    color: var(--clr-text);
}

/* Hide the raw IRIS OnPage() wrapper — form is moved by JS */
body > div[style],
body > table {
    display: none !important;
}

/* ── Two-column page shell ──────────────────────────────────────── */
.login-page {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ── Left panel — architectural photo ──────────────────────────── */
.login-left {
    flex: 0 0 58%;
    background-image: url('../images/Immeuble-grdf.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    min-height: 100vh;
    position: relative;
}

/* Subtle dark vignette at the bottom for depth */
.login-left::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 55%,
        rgba(0, 0, 0, 0.28) 100%
    );
    pointer-events: none;
}

/* ── Right panel — card column ──────────────────────────────────── */
.login-right {
    flex: 1 1 42%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--clr-bg);
}

/* ── Login card ─────────────────────────────────────────────────── */
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--clr-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 48px 44px 42px;
}

/* ── Logos ──────────────────────────────────────────────────────── */
.login-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 28px;
    margin-bottom: 32px;
}

.login-logo {
    height: 44px;
    width: auto;
    object-fit: contain;
    display: block;
}

/* ── Header text ────────────────────────────────────────────────── */
.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--clr-primary);
    letter-spacing: -0.3px;
    margin-bottom: 7px;
}

.login-header p {
    font-size: 13px;
    color: var(--clr-muted);
    line-height: 1.4;
}

/* ── Footer ─────────────────────────────────────────────────────── */
.login-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--clr-divider);
}

.login-footer p {
    font-size: 12px;
    color: var(--clr-muted);
    letter-spacing: 0.01em;
}

/* ══════════════════════════════════════════════════════════════════
   IRIS form — %CSP.Login generates form[name="Login"] with a
   table.login, td.loginCaption labels, and IRISUsername /
   IRISPassword inputs.  We restyle everything to match the design.
══════════════════════════════════════════════════════════════════ */

#login-form-area {
    width: 100%;
}

form[name="Login"] {
    width: 100%;
}

/* Flatten the table layout to a vertical flex stack */
form[name="Login"] table.login {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

form[name="Login"] table.login > tbody > tr {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

form[name="Login"] table.login td {
    display: block;
    width: 100%;
    padding: 0 !important;
}

/* ── Labels ─────────────────────────────────────────────────────── */
form[name="Login"] table.login td.loginCaption {
    font-size: 13px;
    font-weight: 700;
    color: var(--clr-label);
    padding-bottom: 7px !important;
    white-space: normal;
}

/* Red required asterisk after each label */
form[name="Login"] table.login td.loginCaption::after {
    content: ' *';
    color: var(--clr-required);
    font-weight: 700;
}

/* ── Text / Password inputs ─────────────────────────────────────── */
form[name="Login"] input[type="text"],
form[name="Login"] input[type="password"] {
    width: 100% !important;
    padding: 12px 15px;
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-input);
    font-size: 14px;
    font-family: var(--font-base);
    color: var(--clr-text);
    background: var(--clr-input-bg);
    transition: border-color 0.2s ease, box-shadow 0.2s ease,
                background 0.2s ease;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
}

form[name="Login"] input[type="text"]::placeholder,
form[name="Login"] input[type="password"]::placeholder {
    color: #c0c8d0;
}

form[name="Login"] input[type="text"]:focus,
form[name="Login"] input[type="password"]:focus {
    outline: none;
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3.5px var(--clr-primary-glow);
    background: #fff;
}

/* ── Submit button — full-width pill ────────────────────────────── */
form[name="Login"] input[type="submit"] {
    width: 100% !important;
    padding: 14px 20px;
    margin-top: 6px;
    border: none;
    border-radius: var(--radius-btn);
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-base);
    letter-spacing: 0.02em;
    color: #fff;
    background: var(--clr-primary);
    cursor: pointer;
    transition: background 0.2s ease,
                transform 0.15s ease,
                box-shadow 0.2s ease;
    display: block;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
}

form[name="Login"] input[type="submit"]:hover {
    background: var(--clr-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-btn-hover);
}

form[name="Login"] input[type="submit"]:active {
    transform: translateY(0);
    box-shadow: none;
}

form[name="Login"] input[type="submit"]:focus-visible {
    outline: 3px solid var(--clr-primary);
    outline-offset: 3px;
}

/* ── Error / message blocks ─────────────────────────────────────── */
.ErrorMessage,
form[name="Login"] .ErrorMessage {
    background: var(--clr-error-bg);
    color: var(--clr-error-text);
    font-size: 13px;
    font-weight: 500;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--clr-error-border);
    margin-bottom: 18px;
    text-align: center;
}

/* ══════════════════════════════════════════════════════════════════
   Responsive — single column on narrow viewports
══════════════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
    .login-page {
        flex-direction: column;
    }

    /* Compact banner on tablet */
    .login-left {
        flex: none;
        min-height: 220px;
        width: 100%;
    }

    .login-right {
        flex: none;
        width: 100%;
        padding: 32px 20px 40px;
    }
}

@media (max-width: 480px) {
    /* Hide photo on small phones to maximise usable space */
    .login-left {
        min-height: 140px;
    }

    .login-card {
        padding: 36px 26px 32px;
        border-radius: 14px;
    }

    .login-logos {
        gap: 20px;
        margin-bottom: 24px;
    }

    .login-logo {
        height: 36px;
    }

    .login-header h1 {
        font-size: 19px;
    }
}
