/* =========================================================
   MYDJAKA ERP — AUTH (connexion / inscription)
   ---------------------------------------------------------
   Aucune couleur codée en dur : tout passe par les tokens
   de main.css, donc tout bascule proprement en mode sombre.
========================================================= */

.auth-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    background: var(--bg-lime);
}


/* =========================================================
   VISUEL DE MARQUE EN EN-TÊTE
========================================================= */

.header-image,
.header-image-register {
    width: 100%;
    position: relative;
    flex-shrink: 0;
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
    box-shadow: 0 18px 40px -20px rgba(10, 35, 32, .45);
    overflow: hidden;
}

.header-image {
    height: 30vh;
    min-height: 220px;
    background:
        linear-gradient(
            180deg,
            rgba(10, 35, 32, .25) 0%,
            rgba(10, 35, 32, .58) 100%
        ),
        url('../assets/brand-billboard.jpg') center/cover no-repeat;
}

.header-image-register {
    height: 25vh;
    min-height: 190px;
    background:
        linear-gradient(
            180deg,
            rgba(10, 35, 32, .22) 0%,
            rgba(10, 35, 32, .58) 100%
        ),
        url('../assets/brand-signage.jpg') center/cover no-repeat;
}


/* ---- Logo + signature posés sur le visuel ---- */

.header-brand {
    position: absolute;
    left: 7vw;
    bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 5;
}

.header-brand img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .55));
}

.header-brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.15;
    color: #fff;
}

.header-brand-name {
    font-size: .95rem;
    font-weight: 800;
    letter-spacing: .13em;
}

.header-brand-baseline {
    font-size: .64rem;
    font-weight: 500;
    letter-spacing: .04em;
    color: var(--citron-40);
}


/* =========================================================
   BOUTON RETOUR — verre, s'adapte au thème
========================================================= */

.back-btn {
    position: absolute;
    top: 20px;
    left: 7vw;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 20;
    text-decoration: none;
    color: #fff;

    background: rgba(255, 255, 255, .18);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, .42);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .3),
        0 6px 18px -6px rgba(10, 35, 32, .4);

    transition: transform .2s cubic-bezier(.34, 1.56, .64, 1),
                background .2s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, .3);
    transform: scale(1.06);
}

.back-btn:active { transform: scale(.94); }

.back-btn svg {
    width: 21px;
    height: 21px;
    stroke: currentColor;
}


/* =========================================================
   FORMULAIRE
========================================================= */

.form-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 34px 7vw 28px;
}

.title {
    font-size: clamp(2rem, 8vw, 2.6rem);
    color: var(--text-main);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.1;
}

.subtitle {
    margin-top: 8px;
    margin-bottom: 30px;
    font-size: clamp(.9rem, 3.6vw, 1rem);
    line-height: 1.45;
    color: var(--text-muted);
}


/* =========================================================
   CHAMPS
========================================================= */

.input-group {
    position: relative;
    margin-bottom: 16px;
}

/* Icône de gauche — change de teinte quand le champ est actif */
.input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    pointer-events: none;
    z-index: 2;
    transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}

/* Bouton de droite (œil, validation) */
.input-right {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    cursor: pointer;
    z-index: 2;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    transition: color .2s ease, background .2s ease;
}

.input-right:hover {
    color: var(--primary-green);
    background: rgba(177, 192, 31, .12);
}

.input-right svg {
    width: 21px;
    height: 21px;
    stroke: currentColor;
}

/* Coche de validation */
.input-right.is-valid {
    color: var(--primary-green);
    cursor: default;
}

.input-group input {
    width: 100%;
    padding: 17px 54px;
    font-size: 1rem;
    font-family: var(--font-family);
    color: var(--text-main);
    outline: none;

    background: var(--bg-input);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .4),
        0 4px 12px -4px rgba(10, 35, 32, .06);

    transition:
        background .25s ease,
        border-color .25s ease,
        box-shadow .25s ease;
}

.input-group input::placeholder {
    color: var(--text-light);
}

.input-group input:focus {
    background: var(--bg-input-focus);
    border-color: rgba(177, 192, 31, .55);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .5),
        0 6px 20px -6px rgba(10, 35, 32, .12),
        0 0 0 4px rgba(177, 192, 31, .18);
}

/* L'icône se rapproche légèrement quand on saisit :
   micro-retour visuel qui confirme le focus. */
.input-group input:focus ~ .input-icon,
.input-group:focus-within .input-icon {
    transform: translateY(-50%) scale(1.1);
}


/* =========================================================
   OPTIONS (se souvenir / mot de passe oublié)
========================================================= */

.options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: .88rem;
    margin: 6px 0 26px;
}

.options label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.options input[type=checkbox] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 6px;
    border: 1.5px solid var(--glass-border);
    background: var(--bg-input);
    position: relative;
    transition: background .2s ease, border-color .2s ease;
}

.options input[type=checkbox]:checked {
    background: var(--primary-green);
    border-color: var(--primary-green);
}

.options input[type=checkbox]:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.forgot-pwd {
    color: var(--primary-green);
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
    transition: opacity .2s ease;
}

.forgot-pwd:hover { opacity: .75; }


/* =========================================================
   SÉPARATEUR + CONNEXION SOCIALE
========================================================= */

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: .85rem;
    margin: 26px 0 20px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider::before { margin-right: 14px; }
.divider::after  { margin-left: 14px; }

.social-login {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 8px;
}

.social-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;

    background: var(--bg-input);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .4),
        0 4px 14px -6px rgba(10, 35, 32, .16);

    transition: transform .2s cubic-bezier(.34, 1.56, .64, 1),
                box-shadow .2s ease;
}

.social-btn:hover {
    transform: translateY(-3px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .5),
        0 10px 22px -8px rgba(10, 35, 32, .26);
}

.social-btn:active { transform: translateY(0) scale(.95); }

.social-btn svg {
    width: 23px;
    height: 23px;
}


/* =========================================================
   PIED DE PAGE
========================================================= */

.footer-text {
    text-align: center;
    margin-top: auto;
    padding-top: 26px;
    font-size: .95rem;
    color: var(--text-muted);
}

.footer-text a {
    color: var(--primary-green);
    text-decoration: none;
    font-weight: 800;
}

.footer-text a:hover { opacity: .75; }


/* =========================================================
   MODE SOMBRE — AJUSTEMENTS DE CONTRASTE
   ---------------------------------------------------------
   Sur fond Forêt Profond, le vert d'accent doit remonter
   au Citron pour rester lisible.
========================================================= */

[data-theme="dark"] .forgot-pwd,
[data-theme="dark"] .footer-text a {
    color: var(--citron);
}

[data-theme="dark"] .input-right:hover {
    color: var(--citron);
}

[data-theme="dark"] .input-right.is-valid {
    color: var(--citron);
}

[data-theme="dark"] .options input[type=checkbox]:checked {
    background: var(--citron);
    border-color: var(--citron);
}

[data-theme="dark"] .options input[type=checkbox]:checked::after {
    border-color: var(--forest-deep);
}

[data-theme="dark"] .input-group input {
    box-shadow:
        inset 0 1px 0 rgba(177, 192, 31, .08),
        0 4px 12px -4px rgba(0, 0, 0, .35);
}

[data-theme="dark"] .input-group input:focus {
    box-shadow:
        inset 0 1px 0 rgba(177, 192, 31, .14),
        0 6px 20px -6px rgba(0, 0, 0, .45),
        0 0 0 4px rgba(177, 192, 31, .2);
}

[data-theme="dark"] .social-btn {
    box-shadow:
        inset 0 1px 0 rgba(177, 192, 31, .1),
        0 4px 14px -6px rgba(0, 0, 0, .45);
}

/* Les logos de marque (Facebook, Google, Apple) gardent leurs
   couleurs officielles ; seul Apple, noir, doit s'éclaircir. */
[data-theme="dark"] .social-btn .social-apple {
    fill: var(--citron-40);
}


/* =========================================================
   ENTRÉE EN CASCADE
   Même grammaire que le splash : chaque bloc monte et se
   révèle, décalé, pour donner du rythme à l'arrivée.
========================================================= */

.auth-reveal {
    opacity: 0;
    animation: auth-reveal-up .7s cubic-bezier(.22, 1, .36, 1) forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes auth-reveal-up {
    from { opacity: 0; transform: translate3d(0, 16px, 0); }
    to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-reveal {
        opacity: 1;
        animation: none !important;
        transform: none;
    }
    .back-btn, .social-btn, .input-icon, .input-group input {
        transition: none;
    }
}
