:root {
    --primary: #0d6efd;
    --dark-blue: #003366;
}

/* --- 1. Réinitialisation Globale --- */
* {
    box-sizing: border-box;
}

html, body {
    height: auto !important;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
}

/* --- 2. Structure Split (Écran divisé) --- */
.split {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    width: 100%;
}

.left {
    flex: 1;
    background: linear-gradient(135deg, var(--dark-blue) 0%, var(--primary) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    min-width: 450px;
}

.right {
    flex: 1;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    min-height: 100vh;
}

/* --- 3. Drapeaux et Sélecteur de langue --- */
.language-switcher {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    direction: ltr !important;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 15px;
    border-radius: 30px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
}

.language-switcher img {
    width: 24px !important;
    height: 16px !important;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: middle;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.4);
}

.language-switcher a {
    color: #fff !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 600;
    margin-right: 10px;
}

.flag-active {
    border: 2px solid #fff !important;
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

/* --- 4. Contenu et Logo (AVEC CADRE) --- */
.logo-wrap {
    z-index: 2;
    text-align: center;
    background: rgba(255, 255, 255, 0.1); /* Cadre semi-transparent */
    padding: 25px 40px;
    border-radius: 24px;
    backdrop-filter: blur(10px); /* Effet flou */
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-wrap img {
    height: 100px;
    width: auto;
    margin-bottom: 15px;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.2));
}

.left h1 {
    font-size: 3rem;
    font-weight: 800;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #fff;
}

.left p {
    opacity: 0.9;
    margin-top: 10px;
    max-width: 400px;
    text-align: center;
}

/* --- 5. Carte Formulaire --- */
.card-login {
    width: 100%;
    max-width: 480px;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.06);
    background: #fff;
}

.btn-primary {
    background: var(--primary);
    border: none;
    border-radius: 30px;
    padding: 12px;
    font-weight: 700;
    width: 100%;
}

/* --- 6. Cercles Animés --- */
.circles {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1; padding: 0; margin: 0; list-style: none;
}

.circles li {
    position: absolute;
    display: block;
    background: rgba(255, 255, 255, 0.1);
    animation: animate 25s linear infinite;
    bottom: -150px;
    border-radius: 50%;
}

/* Tailles des cercles */
.circles li:nth-child(1) { left: 25%; width: 80px; height: 80px; }
.circles li:nth-child(2) { left: 10%; width: 20px; height: 20px; animation-delay: 2s; }
.circles li:nth-child(3) { left: 70%; width: 20px; height: 20px; animation-delay: 4s; }
.circles li:nth-child(4) { left: 40%; width: 60px; height: 60px; animation-duration: 18s; }
.circles li:nth-child(5) { left: 65%; width: 20px; height: 20px; }
.circles li:nth-child(6) { left: 75%; width: 110px; height: 110px; animation-delay: 3s; }

@keyframes animate {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(-1200px) rotate(720deg); opacity: 0; }
}

/* --- 7. RESPONSIVE MOBILE --- */
@media (max-width: 992px) {
    .split {
        flex-direction: column !important;
        height: auto !important;
    }

    .left {
        flex: none !important;
        width: 100% !important;
        min-width: 0 !important;
        min-height: 320px !important;
        padding: 50px 20px !important;
    }

    .right {
        flex: none !important;
        width: 100% !important;
        height: auto !important;
        display: block !important; /* Débloque le scroll */
        padding: 40px 15px !important;
    }

    .card-login {
        margin: 0 auto !important;
        max-width: 100% !important;
        padding: 1.5rem !important;
        box-shadow: none;
        border: 1px solid #eee;
    }

    .logo-wrap {
        padding: 15px 25px;
    }

    .logo-wrap img {
        height: 70px;
    }

    .left h1 {
        font-size: 2rem;
    }
}

/* --- 8. RTL (Arabe) --- */
html[lang="ar"] .language-switcher {
    right: auto !important;
    left: 15px !important;
}

[dir="rtl"] .text-start { text-align: right !important; }
[dir="rtl"] .form-label { text-align: right !important; display: block; }
