/* Page de connexion : panneau de marque à gauche, formulaire à droite. Indépendant de main.css, mêmes couleurs que l'application. */

:root {
    --forest-900: #051C12;
    --forest-800: #072F1F;
    --forest-700: #1A3E30;
    --lime: #B4F105;
    --lime-soft: rgba(180, 241, 5, 0.14);

    --bg: #F4F6F5;
    --surface: #FFFFFF;
    --text: #0B130F;
    --text-muted: #5E7068;
    --border: #DCE4E0;
    --border-strong: #C3CFC9;
    --focus-ring: rgba(26, 62, 48, 0.18);

    --danger: #B42318;
    --danger-bg: #FEF3F2;
    --danger-border: #FDA29B;
    --info: #1A3E30;
    --info-bg: #EEF5F1;
    --info-border: #BFD6CA;
    --warning: #8A5A00;
    --warning-bg: #FFF7E6;

    --radius: 12px;
    --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0A120E;
        --surface: #111C17;
        --text: #E8EFEB;
        --text-muted: #93A59C;
        --border: #24342C;
        --border-strong: #34483E;
        --focus-ring: rgba(180, 241, 5, 0.22);
        --danger: #FDA29B;
        --danger-bg: #2A1513;
        --danger-border: #7A271A;
        --info: #CFE5D8;
        --info-bg: #13241C;
        --info-border: #2C4A3B;
        --warning: #F5C76B;
        --warning-bg: #2A2110;
    }
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

.auth {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    min-height: 100vh;
}

/* Panneau de marque */
.auth-aside {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 48px;
    padding: 48px 56px;
    background: var(--forest-900);
    color: #E6EEE9;
}

/* Trame discrète de papier millimétré, comme un tracé d'électrocardiogramme */
.auth-aside::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

.auth-aside > * { position: relative; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

/* Logo H-Klinika (assets/images/logo-h-klinika.svg) */
.brand-mark {
    display: block;
    width: 44px;
    height: 44px;
}

.aside-body { max-width: 30rem; }

.aside-eyebrow {
    display: inline-block;
    margin-bottom: 18px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--lime-soft);
    color: var(--lime);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.aside-title {
    margin: 0 0 16px;
    font-size: clamp(1.9rem, 2.6vw, 2.6rem);
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #fff;
}

.aside-title em {
    font-style: normal;
    color: var(--lime);
}

.aside-text {
    margin: 0;
    color: #A9BBB2;
    font-size: 1rem;
    line-height: 1.6;
}

.ecg {
    display: block;
    width: 100%;
    height: 90px;
    margin: 36px 0 28px;
}

.ecg path {
    fill: none;
    stroke: var(--lime);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: ecg-trace 2.6s ease-out 0.3s forwards;
}

@keyframes ecg-trace {
    to { stroke-dashoffset: 0; }
}

.modules {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.modules li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #D3DED8;
    font-size: 0.85rem;
    font-weight: 500;
}


.trust {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: #8FA398;
    font-size: 0.8rem;
}


/* Formulaire */
.auth-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px 24px 32px;
}

.auth-panel {
    width: 100%;
    max-width: 400px;
    margin: auto 0;
}

.brand-compact { display: none; }

.auth-heading {
    margin: 0 0 6px;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.auth-sub {
    margin: 0 0 28px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px 14px;
    border: 1px solid var(--info-border);
    border-radius: 10px;
    background: var(--info-bg);
    color: var(--info);
    font-size: 0.875rem;
    line-height: 1.45;
}

.notice i { margin-top: 1px; font-size: 1rem; }

.notice.is-error {
    border-color: var(--danger-border);
    background: var(--danger-bg);
    color: var(--danger);
}

.notice[hidden] { display: none; }

.field { margin-bottom: 18px; }

.field-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 600;
}

.field-label a,
.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.field-label a:hover,
.link-button:hover { color: var(--text); }

.control {
    position: relative;
    display: flex;
    align-items: center;
}

.control > i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 1.05rem;
    pointer-events: none;
}

.input {
    width: 100%;
    height: 50px;
    padding: 0 14px 0 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder { color: #9AABA2; }

.input:hover { border-color: var(--border-strong); }

.input:focus {
    outline: none;
    border-color: var(--forest-700);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

@media (prefers-color-scheme: dark) {
    .input:focus { border-color: var(--lime); }
}

.input[aria-invalid="true"] { border-color: var(--danger); }

.input-password { padding-right: 52px; }

.toggle-password {
    position: absolute;
    right: 6px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
}

.toggle-password:hover { color: var(--text); background: var(--bg); }

.toggle-password:focus-visible,
.btn-submit:focus-visible,
.link-button:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.capslock {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--warning-bg);
    color: var(--warning);
    font-size: 0.8rem;
    font-weight: 600;
}

.capslock[hidden] { display: none; }

.btn-submit {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 52px;
    margin-top: 26px;
    border: 0;
    border-radius: var(--radius);
    background: var(--forest-900);
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.05s;
}

.btn-submit:hover { background: var(--lime); color: var(--forest-900); }

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

.btn-submit:disabled { opacity: 0.75; cursor: progress; }

@media (prefers-color-scheme: dark) {
    .btn-submit { background: var(--lime); color: var(--forest-900); }
    .btn-submit:hover { background: #C8FA3A; }
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner[hidden] { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

.help {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.help[hidden] { display: none; }

.auth-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 16px;
    margin-top: 40px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.auth-footer a { color: inherit; font-weight: 600; }

/* Tablette et mobile : le panneau de marque devient un bandeau compact */
@media (max-width: 991.98px) {
    .auth { grid-template-columns: 1fr; }

    .auth-aside { display: none; }

    .brand-compact {
        display: inline-flex;
        margin-bottom: 32px;
        color: var(--text);
    }

    .auth-main { justify-content: flex-start; padding: 32px 16px 24px; }
}

@media (prefers-reduced-motion: reduce) {
    .ecg path { animation: none; stroke-dashoffset: 0; }
    .spinner { animation-duration: 2s; }
}
