/* ---- GLOBAL ---- */
body.login-body {
    margin: 0;
    padding: 0;
    background: #fdeba1;
    font-family: "Poppins", sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

body.touch-device .login-input {
    font-size: 16px !important; /* Empêche le zoom sur iOS */
}

.login-container {
    display: flex;
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    max-height: 700px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 25px 70px rgba(21, 42, 110, 0.2);
    animation: containerAppear 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes containerAppear {
    from { 
        opacity: 0; 
        transform: scale(0.95) translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

/* ---- PARTIE GAUCHE (FORMULAIRE) ---- */
.login-left {
    width: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
    padding: 50px 40px;
    position: relative;
    animation: fadeInLeft 0.8s ease;
}

.login-form-box {
    width: 100%;
    max-width: 400px;
}

.login-logo {
    width: 70px;
    height: 70px;
    margin-bottom: 20px;
    border-radius: 18px;
    object-fit: contain;
    padding: 10px;
    background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 100%);
    box-shadow: 0 8px 25px rgba(106, 55, 255, 0.12);
    border: 1px solid rgba(106, 55, 255, 0.1);
}

.login-title {
    font-weight: 800;
    font-size: 34px;
    color: #152A6E;
    margin-bottom: 8px;
    line-height: 1.2;
    background: linear-gradient(135deg, #152A6E 0%, #6a37ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: #64748b;
    margin-bottom: 35px;
    font-size: 15px;
    line-height: 1.6;
}

/* Inputs améliorés */
.login-input-group {
    margin-bottom: 22px;
    position: relative;
}

.login-input-group.focused label {
    color: #6a37ff;
    transform: translateX(5px);
}

.login-input-group label {
    display: block;
    font-weight: 600;
    color: #475569;
    margin-bottom: 10px;
    font-size: 14px;
    padding-left: 5px;
    transition: all 0.3s ease;
}

.login-input {
    border-radius: 16px;
    padding: 18px 22px 18px 60px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 16px;
    background-color: #ffffff;
    width: 100%;
    box-sizing: border-box;
    color: #1e293b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.login-input:focus {
    border-color: #6a37ff;
    background-color: #ffffff;
    box-shadow: 0 8px 30px rgba(106, 55, 255, 0.18);
    transform: translateY(-2px);
    outline: none;
}

.login-input::placeholder {
    color: #94a3b8;
    opacity: 0.7;
}

/* Icones dans les inputs */
.login-input-group::before {
    content: "";
    position: absolute;
    left: 22px;
    top: 52px;
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.5;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.login-input-group:nth-of-type(1)::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236a37ff'%3E%3Cpath d='M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4Z'/%3E%3C/svg%3E");
}

.login-input-group:nth-of-type(2)::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236a37ff'%3E%3Cpath d='M12 17a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2 2 2 0 0 0 2 2Zm6-9a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2h1V6a5 5 0 0 1 10 0v2h1Zm-6-5a3 3 0 0 0-3 3v2h6V6a3 3 0 0 0-3-3Z'/%3E%3C/svg%3E");
}

.login-input:focus ~ .login-input-group::before {
    opacity: 1;
}

/* Button amélioré */
.login-button {
    background: linear-gradient(135deg, #6a37ff 0%, #152A6E 100%);
    color: white;
    padding: 20px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 17px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    width: 100%;
    margin-top: 15px;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(106, 55, 255, 0.25);
}

.login-button:hover:not(:disabled) {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(106, 55, 255, 0.35);
}

.login-button:active:not(:disabled) {
    transform: translateY(-1px);
    transition: transform 0.1s;
}

.login-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.7s;
}

.login-button:hover:not(:disabled)::after {
    left: 100%;
}

/* Message d'erreur */
.alert-danger {
    background: linear-gradient(135deg, #fee 0%, #fff0f0 100%);
    border-left: 4px solid #ff4757;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 28px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.1);
    animation: slideInError 0.3s ease;
}

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

.alert-danger ul {
    padding-left: 20px;
    margin: 0;
}

.alert-danger li {
    margin-bottom: 5px;
}

/* ---- PARTIE DROITE (ILLUSTRATION) ---- */
.login-right {
    width: 50%;
    position: relative;
    background: linear-gradient(135deg, #0f1f5c 0%, #2d1b69 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeInRight 0.8s ease;
    overflow: hidden;
    padding: 50px 40px;
}

/* Éléments décoratifs */
.login-right::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 30% 30%, rgba(106, 55, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(21, 42, 110, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 20%, rgba(126, 91, 255, 0.2) 0%, transparent 50%);
    animation: rotate 30s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Contenu de la partie droite */
.right-content {
    z-index: 3;
    color: white;
    text-align: center;
    max-width: 450px;
    padding: 30px;
    position: relative;
}

.right-content h1 {
    font-size: 38px;
    font-weight: 800;
    margin-bottom: 15px;
    line-height: 1.3;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #ffffff 0%, #a8b4ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.right-content p {
    font-size: 18px;
    opacity: 0.9;
    margin-top: 25px;
    line-height: 1.6;
    font-weight: 300;
}

/* Icône illustrative */
.illustration-icon {
    font-size: 90px;
    margin-bottom: 30px;
    display: block;
    animation: float 6s ease-in-out infinite;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

/* Formes géométriques */
.geometric-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    animation: floatShape 15s ease-in-out infinite;
}

.shape:nth-child(1) {
    width: 100px;
    height: 100px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.shape:nth-child(2) {
    width: 150px;
    height: 150px;
    bottom: 20%;
    right: 15%;
    animation-delay: 2s;
}

.shape:nth-child(3) {
    width: 80px;
    height: 80px;
    top: 50%;
    left: 20%;
    animation-delay: 4s;
}

@keyframes floatShape {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(30px, 30px) rotate(90deg); }
    50% { transform: translate(0, 60px) rotate(180deg); }
    75% { transform: translate(-30px, 30px) rotate(270deg); }
}

/* ---- ANIMATIONS ---- */
@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-40px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(40px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

/* Animation d'entrée pour les éléments du formulaire */
.login-form-box > * {
    opacity: 0;
    animation: slideUpFade 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.login-logo { animation-delay: 0.1s; }
.login-title { animation-delay: 0.2s; }
.login-subtitle { animation-delay: 0.3s; }
.login-input-group:nth-of-type(1) { animation-delay: 0.4s; }
.login-input-group:nth-of-type(2) { animation-delay: 0.5s; }
.login-button { animation-delay: 0.6s; }
.mobile-footer { animation-delay: 0.7s; }

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(25px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================
   VERSION MOBILE COMPLÈTEMENT DIFFÉRENTE
   Design minimaliste et moderne
========================= */
@media (max-width: 992px) {
    body.login-body {
        background: linear-gradient(135deg, #f0f4ff 0%, #ffffff 100%);
        padding: 0;
        display: block;
        overflow-y: auto;
        min-height: 100vh;
    }

    /* Container mobile complètement différent */
    .login-container {
        flex-direction: column;
        width: 100%;
        height: auto;
        min-height: 100vh;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
        animation: mobileContainerAppear 0.8s ease;
    }

    @keyframes mobileContainerAppear {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    /* CACHER COMPLÈTEMENT LA PARTIE DROITE SUR MOBILE */
    .login-right {
        display: none !important;
    }

    /* DESIGN MOBILE UNIQUE - FORMULAIRE FULL SCREEN */
    .login-left {
        width: 100%;
        height: 100vh;
        min-height: 100vh;
        padding: 20px;
        margin: 0;
        background: linear-gradient(135deg, #e5d58f 0%, #f8faff 100%);
        display: flex;
        align-items: center;
        justify-content: center;
        animation: mobileSlideUp 0.8s ease;
        border-radius: 0;
    }

    @keyframes mobileSlideUp {
        from { transform: translateY(30px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }

    .login-form-box {
        max-width: 100%;
        width: 100%;
        padding: 40px 30px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-radius: 32px;
        box-shadow: 
            0 20px 60px rgba(21, 42, 110, 0.15),
            0 0 0 1px rgba(255, 255, 255, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.3);
        position: relative;
        overflow: hidden;
    }

    /* Effet de fond décoratif mobile */
    .login-form-box::before {
        content: "";
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: 
            radial-gradient(circle at 80% 20%, rgba(106, 55, 255, 0.05) 0%, transparent 50%),
            radial-gradient(circle at 20% 80%, rgba(21, 42, 110, 0.05) 0%, transparent 50%);
        z-index: 0;
    }

    /* Logo mobile */
    .login-logo {
        width: 80px;
        height: 80px;
        margin: 0 auto 25px;
        display: block;
        border-radius: 22px;
        box-shadow: 
            0 15px 35px rgba(106, 55, 255, 0.15),
            inset 0 1px 1px rgba(255, 255, 255, 0.5);
        border: 2px solid rgba(255, 255, 255, 0.3);
        position: relative;
        z-index: 1;
        animation: mobileLogoFloat 4s ease-in-out infinite;
    }

    @keyframes mobileLogoFloat {
        0%, 100% { transform: translateY(0) rotate(0deg); }
        50% { transform: translateY(-10px) rotate(5deg); }
    }

    /* Titre mobile */
    .login-title {
        font-size: 32px;
        text-align: center;
        margin-bottom: 12px;
        position: relative;
        z-index: 1;
    }

    .login-subtitle {
        text-align: center;
        font-size: 15px;
        margin-bottom: 40px;
        position: relative;
        z-index: 1;
        color: #64748b;
    }

    /* Inputs mobile - Design amélioré */
    .login-input-group {
        margin-bottom: 25px;
        position: relative;
        z-index: 1;
    }

    .login-input-group label {
        font-size: 15px;
        color: #475569;
        margin-bottom: 12px;
        padding-left: 10px;
        font-weight: 600;
    }

    .login-input {
        padding: 20px 20px 20px 60px;
        border-radius: 18px;
        font-size: 17px;
        border: 2px solid #e2e8f0;
        background: rgba(255, 255, 255, 0.9);
        box-shadow: 
            0 6px 20px rgba(0, 0, 0, 0.04),
            inset 0 1px 3px rgba(255, 255, 255, 0.5);
        transition: all 0.3s ease;
    }

    .login-input:focus {
        border-color: #6a37ff;
        box-shadow: 
            0 10px 35px rgba(106, 55, 255, 0.2),
            inset 0 1px 3px rgba(255, 255, 255, 0.5);
        transform: translateY(-3px);
        background: #ffffff;
    }

    /* Icônes mobile plus grandes */
    .login-input-group::before {
        left: 22px;
        top: 58px;
        width: 24px;
        height: 24px;
    }

    /* Bouton mobile - Design premium */
    .login-button {
        padding: 22px;
        border-radius: 18px;
        font-size: 18px;
        font-weight: 700;
        margin-top: 25px;
        position: relative;
        z-index: 1;
        box-shadow: 
            0 15px 40px rgba(106, 55, 255, 0.3),
            inset 0 1px 1px rgba(255, 255, 255, 0.3);
        background: linear-gradient(135deg, #6a37ff 0%, #152A6E 100%);
        border: none;
        overflow: hidden;
    }

    .login-button::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        transform: translateX(-100%);
    }

    .login-button:hover:not(:disabled)::before {
        animation: shine 1.5s ease;
    }

    @keyframes shine {
        0% { transform: translateX(-100%); }
        100% { transform: translateX(100%); }
    }

    .login-button:active:not(:disabled) {
        transform: scale(0.98);
        transition: transform 0.1s;
    }

    /* Message d'erreur mobile */
    .alert-danger {
        margin-bottom: 30px;
        border-radius: 16px;
        padding: 18px 22px;
        position: relative;
        z-index: 1;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        background: rgba(255, 71, 87, 0.08);
        border-left: 4px solid #ff4757;
    }

    /* Footer mobile avec lien */
    .mobile-footer {
        text-align: center;
        margin-top: 40px;
        padding-top: 25px;
        border-top: 1px solid rgba(226, 232, 240, 0.5);
        position: relative;
        z-index: 1;
        font-size: 14px;
        color: #64748b;
    }

    .mobile-footer a {
        color: #6a37ff;
        text-decoration: none;
        font-weight: 600;
        transition: color 0.3s ease;
    }

    .mobile-footer a:hover {
        color: #152A6E;
        text-decoration: underline;
    }

    /* Animation de parallaxe pour mobile */
    .login-form-box {
        transition: transform 0.2s ease-out;
    }
}

/* =========================
   PETITS ÉCRANS MOBILE
========================= */
@media (max-width: 576px) {
    .login-form-box {
        max-width: 100%;
        padding: 35px 25px;
        border-radius: 28px;
    }

    .login-logo {
        width: 70px;
        height: 70px;
        border-radius: 20px;
    }

    .login-title {
        font-size: 28px;
    }

    .login-subtitle {
        font-size: 14px;
        margin-bottom: 35px;
    }

    .login-input {
        padding: 18px 18px 18px 55px;
        font-size: 16px;
    }

    .login-input-group::before {
        left: 20px;
        top: 54px;
        width: 22px;
        height: 22px;
    }

    .login-button {
        padding: 20px;
        font-size: 17px;
    }
}

/* =========================
   TRÈS PETITS ÉCRANS
========================= */
@media (max-width: 380px) {
    .login-left {
        padding: 15px;
    }

    .login-form-box {
        max-width: 100%;
        padding: 30px 20px;
        border-radius: 24px;
    }

    .login-logo {
        width: 65px;
        height: 65px;
        border-radius: 18px;
    }

    .login-title {
        font-size: 26px;
    }

    .login-subtitle {
        font-size: 13px;
    }

    .login-input {
        padding: 16px 16px 16px 50px;
    }

    .login-button {
        padding: 18px;
        font-size: 16px;
    }
}

/* =========================
   MODE PAYSAGE MOBILE
========================= */
@media (max-height: 600px) and (orientation: landscape) {
    .login-left {
        min-height: auto;
        padding: 20px 0;
        height: auto;
    }

    .login-form-box {
        padding: 25px 30px;
        max-width: 85%;
    }

    .login-logo {
        width: 60px;
        height: 60px;
        margin-bottom: 15px;
    }

    .login-title {
        font-size: 26px;
        margin-bottom: 8px;
    }

    .login-subtitle {
        margin-bottom: 25px;
        font-size: 14px;
    }

    .login-input-group {
        margin-bottom: 15px;
    }

    .login-input {
        padding: 16px 16px 16px 50px;
    }

    .login-button {
        padding: 18px;
        margin-top: 20px;
    }
    
    .mobile-footer {
        margin-top: 25px;
        padding-top: 15px;
    }
}

/* =========================
   SUPPORT DES NAVIGATEURS
========================= */
@supports not (backdrop-filter: blur(20px)) {
    .login-form-box {
        background: rgba(255, 255, 255, 0.98);
    }
    
    @media (max-width: 992px) {
        .login-form-box {
            background: rgba(255, 255, 255, 0.98);
        }
        
        .alert-danger {
            background: rgba(255, 238, 238, 0.95);
        }
    }
}