/* =========================================================================
   SAYTU AUDIT — Page de connexion (refonte v3.0)
   Split-screen, glassmorphism, animations sequentielles d'apparition
   Palette : bleu marine #062E47 / #0B3D5C / #154A70 + or #C9A961
   ========================================================================= */

* { box-sizing: border-box; }

:root {
    --auth-navy-900: #062E47;
    --auth-navy-800: #0B3D5C;
    --auth-navy-700: #154A70;
    --auth-navy-600: #1F608E;
    --auth-gold-300: #E5CB89;
    --auth-gold-400: #D4B873;
    --auth-gold-500: #C9A961;
    --auth-gold-600: #A88947;
    --auth-text-dark: #0F172A;
    --auth-text-muted: #64748B;
    --auth-bg-soft: #F8FAFC;
    --auth-border: #E2E8F0;
    --auth-danger: #DC2626;
    --auth-danger-bg: #FEE2E2;
    --auth-success: #16A34A;
    --auth-success-bg: #DCFCE7;
    --auth-warning: #D97706;
    --auth-warning-bg: #FEF3C7;
}

html, body { height: 100%; }
body.auth-body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--auth-text-dark);
    background: var(--auth-bg-soft);
    overflow: hidden;
}

/* =========================================================================
   SCENE PRINCIPALE - split screen
   ========================================================================= */
.auth-stage {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* =========================================================================
   PANNEAU GAUCHE : BRAND
   ========================================================================= */
.auth-brand-panel {
    position: relative;
    background: linear-gradient(135deg, #041F30 0%, var(--auth-navy-900) 35%, var(--auth-navy-800) 100%);
    color: white;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    animation: panelLeftIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes panelLeftIn {
    from { transform: translateX(-30px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* Couches decoratives de fond */
.auth-brand-bg {
    position: absolute; inset: 0;
    pointer-events: none;
    opacity: 0;
    animation: bgFadeIn 1.2s 0.2s ease-out forwards;
}
@keyframes bgFadeIn { to { opacity: 1; } }

/* Grille subtile */
.auth-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(201,169,97,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(201,169,97,0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 30%, transparent 80%);
}

/* Orbes flottants en arriere-plan */
.auth-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
}
.auth-orb-1 {
    width: 480px; height: 480px;
    background: radial-gradient(circle, rgba(31,96,142,0.65), transparent 70%);
    top: -180px; left: -120px;
    animation: orbDrift1 22s ease-in-out infinite;
}
.auth-orb-2 {
    width: 380px; height: 380px;
    background: radial-gradient(circle, rgba(201,169,97,0.28), transparent 70%);
    bottom: -120px; right: -80px;
    animation: orbDrift2 26s ease-in-out infinite;
}
.auth-orb-3 {
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(212,184,115,0.18), transparent 70%);
    top: 40%; right: 10%;
    animation: orbDrift3 30s ease-in-out infinite;
}
@keyframes orbDrift1 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(40px, 30px); }
}
@keyframes orbDrift2 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(-30px, -40px); }
}
@keyframes orbDrift3 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(-25px, 25px); }
}

/* Contenu central */
.auth-brand-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 28px;
}

/* ----- Embleme central avec orbites ----- */
.auth-emblem {
    position: relative;
    width: 220px; height: 220px;
    display: flex; align-items: center; justify-content: center;
    margin-top: 4px;
    opacity: 0;
    animation: emblemIn 0.9s 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes emblemIn {
    from { opacity: 0; transform: scale(0.6); }
    to   { opacity: 1; transform: scale(1); }
}

.auth-emblem-rings { position: absolute; inset: 0; }
.auth-emblem-rings .ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(201,169,97,0.35);
}
.auth-emblem-rings .ring-1 {
    inset: 0;
    border-style: dashed;
    animation: ringRotate 28s linear infinite;
}
.auth-emblem-rings .ring-2 {
    inset: 14px;
    border-color: rgba(201,169,97,0.22);
}
.auth-emblem-rings .ring-3 {
    inset: 28px;
    border-color: rgba(201,169,97,0.55);
    border-width: 2px;
    box-shadow: 0 0 24px rgba(201,169,97,0.30) inset;
}
@keyframes ringRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
/* Trois petits points orbitaux */
.auth-emblem-rings .ring-1::before,
.auth-emblem-rings .ring-1::after {
    content: '';
    position: absolute;
    width: 8px; height: 8px;
    background: var(--auth-gold-400);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--auth-gold-400);
}
.auth-emblem-rings .ring-1::before { top: -5px; left: 50%; transform: translateX(-50%); }
.auth-emblem-rings .ring-1::after  { bottom: -5px; right: 26%; }

.auth-emblem-disc {
    position: relative;
    width: 130px; height: 130px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,0.16), transparent 60%),
        linear-gradient(135deg, #0F4D72 0%, #062E47 100%);
    display: flex; align-items: center; justify-content: center;
    box-shadow:
        0 8px 32px rgba(0,0,0,0.45),
        0 0 0 2px rgba(201,169,97,0.55),
        0 0 0 6px rgba(201,169,97,0.10);
    overflow: hidden;
}
.auth-emblem-disc img {
    width: 80%; height: 80%; object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}
.auth-emblem-letter {
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-size: 56px;
    color: var(--auth-gold-400);
    letter-spacing: -2px;
    line-height: 1;
}

/* ----- Titre cabinet ----- */
.auth-brand-headline {
    opacity: 0;
    animation: fadeUp 0.7s 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.auth-brand-eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--auth-gold-400);
    margin-bottom: 8px;
}
.auth-brand-title {
    font-family: 'Playfair Display', serif;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.5px;
    color: white;
    margin: 0 0 14px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.auth-flag {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 0 auto 12px;
    width: 120px;
    border-radius: 2px;
    overflow: hidden;
    height: 3px;
}
.auth-flag span { flex: 1; height: 100%; }
.auth-flag span:nth-child(1) { background: #00853F; }
.auth-flag span:nth-child(2) { background: #FCD116; }
.auth-flag span:nth-child(3) { background: #E31B23; }
.auth-brand-motto {
    font-size: 13px;
    font-weight: 400;
    color: rgba(255,255,255,0.78);
    letter-spacing: 0.4px;
    margin: 0;
}

/* ----- Carte glassmorphism ----- */
.auth-feature-card {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(201,169,97,0.25);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    gap: 14px;
    align-items: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-align: left;
    box-shadow: 0 8px 32px rgba(0,0,0,0.20);
    opacity: 0;
    animation: fadeUp 0.7s 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.auth-feature-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--auth-gold-500), var(--auth-gold-600));
    display: flex; align-items: center; justify-content: center;
    color: var(--auth-navy-900);
    font-size: 17px;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(201,169,97,0.35);
}
.auth-feature-text { display: flex; flex-direction: column; gap: 2px; }
.auth-feature-text strong {
    font-size: 14px;
    font-weight: 600;
    color: white;
    letter-spacing: 0.2px;
}
.auth-feature-text span {
    font-size: 11.5px;
    color: rgba(255,255,255,0.72);
    line-height: 1.4;
}

/* ----- Pill version avec point pulsant ----- */
.auth-version-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(201,169,97,0.32);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: white;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    animation: fadeUp 0.6s 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.auth-version-dot {
    width: 8px; height: 8px;
    background: #4ADE80;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(74,222,128,0.7);
    animation: pulseDot 1.8s ease-in-out infinite;
}
.auth-version-tag { color: var(--auth-gold-400); }
@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.35); opacity: 0.65; }
}

/* ----- Trois traits ----- */
.auth-traits {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    font-size: 11.5px;
    color: rgba(255,255,255,0.55);
    font-weight: 500;
    opacity: 0;
    animation: fadeUp 0.6s 1.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.auth-traits span i {
    color: var(--auth-gold-400);
    margin-right: 5px;
    font-size: 10px;
}
.auth-traits-sep { color: rgba(201,169,97,0.45); font-weight: 700; }

/* =========================================================================
   PANNEAU DROIT : FORMULAIRE
   ========================================================================= */
.auth-form-panel {
    background: white;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
    animation: panelRightIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes panelRightIn {
    from { transform: translateX(30px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.auth-form-wrap {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* ----- Logo cabinet en haut ----- */
.auth-form-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--auth-bg-soft);
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    align-self: flex-start;
    opacity: 0;
    animation: fadeRight 0.6s 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.auth-form-logo img {
    width: 38px; height: 38px;
    object-fit: contain;
    border-radius: 8px;
}
.auth-form-logo-fallback {
    width: 38px; height: 38px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--auth-navy-800), var(--auth-navy-700));
    display: flex; align-items: center; justify-content: center;
    color: var(--auth-gold-400);
    font-size: 18px;
}
.auth-form-logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.auth-form-logo-text strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--auth-navy-900);
    letter-spacing: 0.2px;
}
.auth-form-logo-text span {
    font-size: 10px;
    color: var(--auth-text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ----- Contenu form ----- */
.auth-form-content { display: flex; flex-direction: column; gap: 0; }

.auth-form-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--auth-gold-500);
    margin-bottom: 10px;
}
.auth-form-title {
    font-family: 'Playfair Display', serif;
    font-size: 38px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--auth-navy-900);
    margin: 0 0 14px;
    letter-spacing: -1px;
}
.auth-form-lead {
    font-size: 14px;
    color: var(--auth-text-muted);
    line-height: 1.55;
    margin: 0 0 28px;
}

/* ----- Flash messages ----- */
.auth-flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 18px;
    border: 1px solid transparent;
    line-height: 1.4;
}
.auth-flash i { flex-shrink: 0; font-size: 14px; }
.auth-flash-error   { background: var(--auth-danger-bg);  color: #991B1B; border-color: rgba(220,38,38,0.2); }
.auth-flash-success { background: var(--auth-success-bg); color: #166534; border-color: rgba(22,163,74,0.2); }
.auth-flash-warning { background: var(--auth-warning-bg); color: #92400E; border-color: rgba(217,119,6,0.25); }
.auth-flash-info    { background: #DBEAFE; color: #1E40AF; border-color: rgba(30,64,175,0.2); }

/* ----- Champs ----- */
.auth-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.auth-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--auth-text-muted);
}
.auth-input {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--auth-bg-soft);
    border: 1.5px solid var(--auth-border);
    border-radius: 12px;
    transition: all 0.18s ease;
}
.auth-input:hover { border-color: #CBD5E1; }
.auth-input:focus-within {
    background: white;
    border-color: var(--auth-navy-700);
    box-shadow: 0 0 0 4px rgba(11,61,92,0.10);
}
.auth-input > i {
    width: 44px;
    text-align: center;
    color: #94A3B8;
    font-size: 14px;
    flex-shrink: 0;
}
.auth-input:focus-within > i { color: var(--auth-navy-700); }
.auth-input input {
    flex: 1;
    width: 100%;
    padding: 14px 14px 14px 0;
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 15px;
    color: var(--auth-text-dark);
    letter-spacing: 0.2px;
}
.auth-input input::placeholder { color: #94A3B8; font-weight: 400; }
.auth-input input::-ms-reveal,
.auth-input input::-ms-clear { display: none; }

.auth-toggle-pwd {
    background: transparent;
    border: none;
    color: #94A3B8;
    width: 44px;
    height: 100%;
    cursor: pointer;
    transition: color 0.15s;
    font-size: 14px;
}
.auth-toggle-pwd:hover { color: var(--auth-navy-800); }

/* ----- Ligne checkbox + lien ----- */
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 0 22px;
    flex-wrap: wrap;
    gap: 10px;
}
.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--auth-text-muted);
    user-select: none;
}
.auth-check input { display: none; }
.auth-check-box {
    width: 18px; height: 18px;
    border: 1.5px solid #CBD5E1;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
    background: white;
    flex-shrink: 0;
}
.auth-check-box::after {
    content: '';
    width: 4px; height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    margin-bottom: 2px;
    transition: transform 0.15s ease;
}
.auth-check input:checked + .auth-check-box {
    background: var(--auth-navy-800);
    border-color: var(--auth-navy-800);
}
.auth-check input:checked + .auth-check-box::after { transform: rotate(45deg) scale(1); }

.auth-forgot {
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-gold-600);
    text-decoration: none;
    transition: color 0.15s;
}
.auth-forgot:hover { color: var(--auth-gold-500); }

/* ----- Bouton submit ----- */
.auth-submit {
    position: relative;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--auth-navy-900) 0%, var(--auth-navy-700) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 6px 18px rgba(11,61,92,0.30);
}
.auth-submit::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(201,169,97,0.30), transparent);
    transition: left 0.6s ease;
}
.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(11,61,92,0.42);
}
.auth-submit:hover::before { left: 120%; }
.auth-submit:active { transform: translateY(0); }
.auth-submit:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.auth-submit i { font-size: 12px; transition: transform 0.2s; }
.auth-submit:hover i { transform: translateX(4px); }
.auth-submit.is-loading i { animation: spinLoad 0.9s linear infinite; }
@keyframes spinLoad {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.auth-links {
    margin-top: 18px;
    text-align: center;
    font-size: 13px;
}
.auth-links a {
    color: var(--auth-text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}
.auth-links a:hover { color: var(--auth-navy-800); }
.auth-links a i { margin-right: 6px; }

/* ----- Footer panneau droit ----- */
.auth-form-foot {
    margin-top: auto;
    padding-top: 22px;
    border-top: 1px solid var(--auth-border);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}
.auth-foot-brand { display: flex; flex-direction: column; line-height: 1.3; }
.auth-foot-brand strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--auth-navy-900);
    letter-spacing: 1px;
}
.auth-foot-brand span {
    font-size: 11px;
    color: var(--auth-text-muted);
    letter-spacing: 0.4px;
}
.auth-foot-credit {
    font-size: 11px;
    color: var(--auth-text-muted);
    text-align: right;
    line-height: 1.5;
}

/* =========================================================================
   ANIMATIONS SEQUENTIELLES (apparition au chargement, side droit)
   ========================================================================= */
[data-anim] {
    opacity: 0;
    animation: fadeUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
[data-anim="form-1"] { animation-delay: 0.55s; }
[data-anim="form-2"] { animation-delay: 0.65s; }
[data-anim="form-3"] { animation-delay: 0.75s; }
[data-anim="form-4"] { animation-delay: 0.85s; }
[data-anim="form-5"] { animation-delay: 0.90s; }
[data-anim="form-6"] { animation-delay: 1.00s; }
[data-anim="form-7"] { animation-delay: 1.10s; }
[data-anim="form-8"] { animation-delay: 1.20s; }
[data-anim="form-9"] { animation-delay: 1.35s; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeRight {
    from { opacity: 0; transform: translateX(-14px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Respect des preferences d'accessibilite */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1024px) {
    .auth-form-title { font-size: 32px; }
    .auth-brand-title { font-size: 26px; }
}

@media (max-width: 880px) {
    body.auth-body { overflow: auto; }
    .auth-stage {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
    }
    .auth-brand-panel {
        padding: 36px 24px 30px;
        min-height: auto;
    }
    .auth-emblem { width: 160px; height: 160px; }
    .auth-emblem-disc { width: 92px; height: 92px; }
    .auth-emblem-letter { font-size: 38px; }
    .auth-form-panel { padding: 30px 24px 36px; }
    .auth-brand-content { gap: 18px; }
    .auth-brand-title { font-size: 22px; }
    .auth-form-title  { font-size: 28px; }
    .auth-traits { font-size: 10.5px; gap: 10px; }
}

@media (max-width: 480px) {
    .auth-brand-panel { padding: 28px 18px 22px; }
    .auth-form-panel  { padding: 24px 18px 30px; }
    .auth-emblem { width: 140px; height: 140px; }
    .auth-emblem-disc { width: 80px; height: 80px; }
    .auth-row { flex-direction: column; align-items: flex-start; }
    .auth-form-foot { flex-direction: column; align-items: flex-start; }
    .auth-foot-credit { text-align: left; }
}
