/* Reset global pour éviter le scroll */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

:root {
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --surface-color: rgba(255, 255, 255, 0.95);
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --text-muted: rgba(71, 85, 105, 0.6);
}

.login-container {
    background: #f8fafc;
    height: 100vh;
    width: 100vw;
    perspective: 800px;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
}

.login-card {
    background: var(--surface-color);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    transform-style: preserve-3d;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow:
            0 4px 12px rgba(0, 0, 0, 0.06),
            0 12px 24px rgba(0, 0, 0, 0.08),
            0 20px 40px rgba(0, 0, 0, 0.04),
            inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.login-card:hover {
    transform:
            translateY(-3px)
            rotateX(1deg)
            rotateY(-0.5deg)
            scale3d(1.005, 1.005, 1.005);
    box-shadow:
            0 6px 16px rgba(0, 0, 0, 0.08),
            0 16px 32px rgba(0, 0, 0, 0.1),
            0 24px 48px rgba(0, 0, 0, 0.06),
            0 32px 64px rgba(99, 102, 241, 0.04),
            inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* État quand un input est focus - carte stable */
.login-card.input-focused {
    transform: translateY(0) rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1) !important;
    transition: all 0.2s ease;
}

.input-modern {
    background: rgba(248, 250, 252, 0.8);
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-style: preserve-3d;
    position: relative;
    z-index: 1;
    box-shadow:
            0 1px 3px rgba(0, 0, 0, 0.04),
            0 2px 6px rgba(0, 0, 0, 0.02),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.input-modern:hover:not(:focus) {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow:
            0 2px 6px rgba(0, 0, 0, 0.06),
            0 4px 12px rgba(0, 0, 0, 0.04),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.input-modern:focus {
    background: rgba(255, 255, 255, 0.95);
    border-color: #6366f1;
    transform: translateY(0);
    box-shadow:
            0 4px 12px rgba(99, 102, 241, 0.08),
            0 8px 20px rgba(99, 102, 241, 0.04),
            0 0 0 3px rgba(99, 102, 241, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Pas d'effet hover quand input est focus */
.input-focused .input-modern:hover {
    transform: translateY(0);
}

.btn-gradient {
    background: var(--primary-gradient);
    border: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-style: preserve-3d;
    box-shadow:
            0 2px 8px rgba(99, 102, 241, 0.2),
            0 4px 16px rgba(99, 102, 241, 0.12),
            inset 0 1px 0 rgba(255, 255, 255, 0.2),
            inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

.btn-gradient:hover {
    transform:
            translateY(-2px)
            scale3d(1.01, 1.01, 1.01);
    box-shadow:
            0 6px 20px rgba(99, 102, 241, 0.25),
            0 12px 32px rgba(99, 102, 241, 0.15),
            0 18px 48px rgba(99, 102, 241, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.3),
            inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

.btn-gradient:active {
    transform:
            translateY(-1px)
            scale3d(0.99, 0.99, 0.99);
    transition: all 0.1s ease;
}

.btn-gradient::before {
    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.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateZ(1px);
}

.btn-gradient:hover::before {
    left: 100%;
}

/* Animations d'entrée douces */
@keyframes slideIn3D {
    from {
        opacity: 0;
        transform:
                translate3d(0, 30px, -100px)
                rotateX(20deg)
                scale3d(0.9, 0.9, 0.9);
    }
    to {
        opacity: 1;
        transform:
                translate3d(0, 0, 0)
                rotateX(0deg)
                scale3d(1, 1, 1);
    }
}

@keyframes fadeInUp3D {
    from {
        opacity: 0;
        transform:
                translate3d(0, 20px, -30px)
                rotateX(10deg);
    }
    to {
        opacity: 1;
        transform:
                translate3d(0, 0, 0)
                rotateX(0deg);
    }
}

@keyframes shake3D {
    0%, 100% { transform: translate3d(0, 0, 0) rotateY(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: translate3d(-4px, 0, 0) rotateY(-1deg); }
    20%, 40%, 60%, 80% { transform: translate3d(4px, 0, 0) rotateY(1deg); }
}

@keyframes bounce3D {
    0%, 20%, 53%, 80%, 100% { transform: translate3d(0, 0, 0) rotateX(0deg); }
    40%, 43% { transform: translate3d(0, -8px, 5px) rotateX(-2deg); }
    70% { transform: translate3d(0, -4px, 2px) rotateX(-1deg); }
    90% { transform: translate3d(0, -1px, 1px) rotateX(-0.5deg); }
}

@keyframes pulse3D {
    0% { transform: scale3d(1, 1, 1); }
    50% { transform: scale3d(1.02, 1.02, 1.02) translateZ(2px); }
    100% { transform: scale3d(1, 1, 1); }
}

.animate-slide-3d { animation: slideIn3D 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.animate-fade-up-3d { animation: fadeInUp3D 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.animate-shake-3d { animation: shake3D 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.animate-bounce-3d { animation: bounce3D 0.8s ease-in-out; }
.animate-pulse-3d { animation: pulse3D 2.5s ease-in-out infinite; }

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.logo-container {
    background: var(--primary-gradient);
    border-radius: 20px;
    padding: 16px;
    display: inline-block;
    margin-bottom: 24px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-style: preserve-3d;
    box-shadow:
            0 3px 10px rgba(99, 102, 241, 0.2),
            0 6px 20px rgba(99, 102, 241, 0.12),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.logo-container:hover {
    transform:
            scale3d(1.05, 1.05, 1.05)
            rotateY(5deg)
            rotateX(2deg)
            translateZ(10px);
    box-shadow:
            0 6px 16px rgba(99, 102, 241, 0.25),
            0 12px 32px rgba(99, 102, 241, 0.15),
            0 18px 48px rgba(99, 102, 241, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.input-group {
    position: relative;
    overflow: visible;
    transform-style: preserve-3d;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%) translateZ(2px);
    color: var(--text-muted);
    z-index: 10;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.input-modern:focus + .input-icon {
    color: #6366f1;
    transform:
            translateY(-50%)
            translateZ(5px)
            scale3d(1.05, 1.05, 1.05);
}

.input-modern:hover:not(:focus) + .input-icon {
    color: #6366f1;
    transform:
            translateY(-50%)
            translateZ(3px)
            scale3d(1.02, 1.02, 1.02);
}

.input-with-icon { padding-left: 48px; }

/* Bouton "œil" robuste et au-dessus des overlays */
.toggle-password {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%) translateZ(2px);
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 20;
    background: transparent;
    border: 0;
    padding: 0;
}
.toggle-password:hover {
    color: #6366f1;
    transform:
            translateY(-50%)
            translateZ(5px)
            scale3d(1.1, 1.1, 1.1);
}

/* Indicateur de succès seulement pour l'identifiant */
.success-indicator {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%) translateZ(2px) scale3d(0, 0, 0);
    color: #10b981;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.field-valid .success-indicator {
    opacity: 1;
    transform:
            translateY(-50%)
            translateZ(5px)
            scale3d(1, 1, 1);
}

/* Masquer l'indicateur de succès pour le mot de passe */
#inputPassword ~ .success-indicator { display: none; }

.error-alert {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
    color: #dc2626;
    transform-style: preserve-3d;
    position: relative;
}

/* Bouton de fermeture de l'alerte */
.close-alert-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
    z-index: 10;
}

.close-alert-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    transform: scale(1.1);
}

.close-alert-btn:active {
    transform: scale(0.95);
}

.stagger-item {
    opacity: 0;
    animation: fadeInUp3D 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@media (max-width: 768px) {
    .login-container { perspective: 600px; }
    .login-card:hover {
        transform:
                translateY(-2px)
                rotateX(0.5deg)
                scale3d(1.002, 1.002, 1.002);
    }
    .login-card.input-focused { transform: translateY(0) !important; }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

