/* ============================================
   CONNEXION.CSS — Page de connexion
   ============================================ */

/* ===== RESET LOCAL ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:       #0f766e;
    --primary-dark:  #064e48;
    --primary-soft:  #e1f5ee;
    --accent:        #2dd4bf;
    --surface:       #ffffff;
    --surface-soft:  #f8fafc;
    --text:          #0f172a;
    --text-secondary:#475569;
    --muted:         #94a3b8;
    --border:        #e2e8f0;
    --error:         #ef4444;
    --error-soft:    #fef2f2;
    --radius:        12px;
    --radius-lg:     18px;
    --shadow:        0 4px 24px rgba(0,0,0,0.07);
    --shadow-lg:     0 16px 64px rgba(0,0,0,0.12);
}

body[data-cyber-theme="dark"] {
    --primary: #2dd4bf;
    --primary-dark: #14b8a6;
    --primary-soft: #123f3b;
    --surface: #0f1d2d;
    --surface-soft: #07111f;
    --text: #f8fafc;
    --text-secondary: #cbd5e1;
    --muted: #a8b8cc;
    --border: #26384f;
    --error-soft: #3b151b;
    --shadow: 0 4px 24px rgba(0, 0, 0, .28);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, .36);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: var(--surface-soft);
    color: var(--text);
    min-height: 100vh;
}

/* ===== LAYOUT SPLIT ===== */
.login-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* ================================================
   PANEL GAUCHE — VISUEL
   ================================================ */
.login-visual {
    position: relative;
    overflow: hidden;
    background: #08111f;
}

.login-visual::before {
    content: "";
    position: absolute;
    inset: -24px;
    background: url("../images/optimized/login-security-bg.93452d56a5fa.jpg") center / cover no-repeat;
    filter: blur(7px);
    opacity: .76;
    transform: scale(1.05);
}

.login-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 75% 18%, rgba(45,212,191,0.26), transparent 38%),
        radial-gradient(circle at 20% 80%, rgba(59,130,246,0.18), transparent 36%),
        linear-gradient(145deg, rgba(8,17,31,.94) 0%, rgba(15,23,42,.9) 50%, rgba(15,118,110,.66) 130%);
}

.visual-inner {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 40px 48px 48px;
}

/* Brand */
.visual-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    animation: fadeInDown 0.6s ease-out both;
}

.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 rgba(45,212,191,0.6);
    animation: pulseDot 2.5s cubic-bezier(0.4,0,0.6,1) infinite;
}

.login-brand-mark {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 8px 18px rgba(45, 212, 191, 0.24));
}

@keyframes pulseDot {
    0%,100% { box-shadow: 0 0 0 0 rgba(45,212,191,0.6); }
    50%      { box-shadow: 0 0 0 8px rgba(45,212,191,0); }
}

/* Texte visuel */
.visual-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 400px;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.visual-eyebrow {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #5eead4;
    margin-bottom: 14px;
}

.visual-headline {
    font-size: clamp(1.9rem, 3.2vw, 2.8rem);
    font-weight: 900;
    letter-spacing: -0.05em;
    line-height: 1.08;
    color: #ffffff;
    margin-bottom: 18px;
}

.visual-sub {
    font-size: 0.97rem;
    color: #94a3b8;
    line-height: 1.6;
}

/* Mini dashboard */
.visual-dashboard {
    position: relative;
    height: 200px;
    margin-top: 32px;
    animation: fadeInUp 0.8s ease-out 0.5s both;
}

.vd-card {
    position: absolute;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.09);
    backdrop-filter: blur(16px);
    border-radius: 20px;
    padding: 16px 20px;
    color: #ffffff;
}

.vd-main {
    left: 0;
    bottom: 0;
    width: 240px;
}

.vd-topline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #cbd5e1;
    margin-bottom: 10px;
}

.vd-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #facc15;
    box-shadow: 0 0 0 5px rgba(250,204,21,0.18);
    animation: pulseDot 2s infinite;
}

.vd-score {
    display: block;
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    margin-bottom: 10px;
}

.vd-bar {
    height: 6px;
    border-radius: 99px;
    background: rgba(255,255,255,0.14);
    overflow: hidden;
}

.vd-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    animation: barFill 1.4s cubic-bezier(0.34,1.56,0.64,1) 0.8s both;
}

@keyframes barFill {
    to { width: 62%; }
}

.vd-float {
    border-radius: 14px;
    padding: 12px 16px;
    min-width: 160px;
}

.vd-float span {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 2px;
}

.vd-float strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
}

.vd-float-top {
    right: 0;
    top: 0;
    animation: floatCard 4s ease-in-out 1s infinite;
}

.vd-float-bottom {
    right: 20px;
    bottom: 20px;
    animation: floatCard 5s ease-in-out 1.5s infinite;
}

@keyframes floatCard {
    0%,100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

/* Orbs */
.orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: orbBreath 7s ease-in-out infinite;
}

.orb-one {
    width: 300px;
    height: 300px;
    top: -80px;
    right: -80px;
    background: rgba(45,212,191,0.18);
    filter: blur(3px);
}

.orb-two {
    width: 200px;
    height: 200px;
    bottom: 80px;
    left: -60px;
    background: rgba(59,130,246,0.15);
    filter: blur(2px);
    animation-delay: 1.5s;
}

@keyframes orbBreath {
    0%,100% { opacity: 0.7; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.06); }
}

/* ================================================
   PANEL DROIT — FORMULAIRE
   ================================================ */
.login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    background: var(--surface);
}

.login-form-inner {
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.7s ease-out 0.1s both;
}

/* Brand mobile */
.form-brand-mobile {
    display: none;
    align-items: center;
    gap: 9px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 32px;
}

.form-brand-mobile .brand-dot {
    background: var(--accent);
    animation: pulseDot 2.5s infinite;
}

/* Header formulaire */
.form-header {
    margin-bottom: 32px;
}

.form-header h1 {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -0.055em;
    color: var(--text);
    line-height: 1;
    margin-bottom: 8px;
}

.form-header p {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* ===== ALERTES ===== */
.form-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 16px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 20px;
    animation: shakeIn 0.4s ease-out;
}

@keyframes shakeIn {
    0%  { transform: translateX(-6px); opacity: 0; }
    40% { transform: translateX(4px); }
    70% { transform: translateX(-2px); }
    100%{ transform: translateX(0); opacity: 1; }
}

.form-alert-error {
    background: var(--error-soft);
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.form-alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* ===== CHAMPS ===== */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.field-labelrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.field-forgot {
    font-size: 0.82rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s;
}

.field-forgot:hover { opacity: 0.7; }

/* Input wrapper */
.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    width: 17px;
    height: 17px;
    color: var(--muted);
    pointer-events: none;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.input-wrap input {
    width: 100%;
    padding: 13px 46px 13px 42px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
}

.input-wrap input::placeholder { color: var(--muted); }

.input-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15,118,110,0.12);
}

.input-wrap input:focus + .input-icon,
.input-wrap:focus-within .input-icon {
    color: var(--primary);
}

/* Field error state */
.field-error .input-wrap input {
    border-color: var(--error);
    background: var(--error-soft);
}

.field-error .input-wrap input:focus {
    box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
}

.field-msg {
    font-size: 0.8rem;
    font-weight: 500;
}

.field-msg-error { color: var(--error); }

/* Bouton oeil */
.input-eye {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--muted);
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
}

.input-eye:hover { color: var(--primary); background: var(--primary-soft); }
.input-eye svg { width: 17px; height: 17px; }

/* ===== CHECKBOX "RESTER CONNECTÉ" ===== */
.field-check { margin-top: -4px; }

.check-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-secondary);
    user-select: none;
}

.check-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.check-box {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

.check-label input:checked ~ .check-box {
    background: var(--primary);
    border-color: var(--primary);
}

.check-label input:checked ~ .check-box::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
}

.check-label:hover .check-box {
    border-color: var(--primary);
}

/* ===== BOUTON SUBMIT ===== */
.btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px 24px;
    border-radius: var(--radius);
    background: var(--primary);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    margin-top: 4px;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    position: relative;
    overflow: hidden;
}

.btn-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.2s ease;
}

.btn-submit:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(15,118,110,0.3);
}

.btn-submit:hover::before { background: rgba(255,255,255,0.04); }

.btn-submit:active {
    transform: translateY(0);
    box-shadow: none;
}

/* État loading */
.btn-submit.loading span { opacity: 0.7; }
.btn-submit.loading svg { animation: spinArrow 0.8s linear infinite; }

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

/* ===== FOOTER FORM ===== */
.form-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-footer a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    transition: opacity 0.2s;
}

.form-footer a:hover { opacity: 0.75; }

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 860px) {
    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-visual {
        display: none;
    }

    .login-form-panel {
        padding: 40px 24px;
        align-items: flex-start;
        padding-top: 52px;
    }

    .form-brand-mobile {
        display: flex;
    }

    .login-form-inner {
        max-width: 100%;
    }

    .form-header h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .login-form-panel {
        padding: 36px 20px;
    }
}

/* ===== ACCESSIBILITÉ ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
