/* ============================================================================
   STACK NOVA ACADEMY - Ultra Professional Login Design
   Design moderne avec glassmorphism, animations fluides et effets premium
   ============================================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Couleurs principales */
    --admin-primary: #10b981;
    --admin-secondary: #059669;
    --admin-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    
    --enseignant-primary: #3b82f6;
    --enseignant-secondary: #1e40af;
    --enseignant-gradient: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    
    --etudiant-primary: #f59e0b;
    --etudiant-secondary: #d97706;
    --etudiant-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    
    --super-admin-primary: #667eea;
    --super-admin-secondary: #764ba2;
    --super-admin-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    /* Couleurs neutres */
    --dark-900: #0f172a;
    --dark-800: #1e293b;
    --dark-700: #334155;
    --gray-600: #475569;
    --gray-500: #64748b;
    --gray-400: #94a3b8;
    --gray-300: #cbd5e1;
    --gray-200: #e2e8f0;
    --gray-100: #f1f5f9;
    --white: #ffffff;
    
    /* Ombres */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--dark-900);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(16, 185, 129, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(245, 158, 11, 0.1) 0%, transparent 50%);
    animation: backgroundPulse 15s ease-in-out infinite;
    z-index: 0;
}

@keyframes backgroundPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Floating particles */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.1), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(255, 255, 255, 0.1), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.1), transparent),
        radial-gradient(1px 1px at 80% 10%, rgba(255, 255, 255, 0.1), transparent);
    background-size: 200% 200%;
    animation: particlesFloat 20s ease-in-out infinite;
    z-index: 0;
}

@keyframes particlesFloat {
    0%, 100% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
}

/* ============================================================================
   LOGIN CONTAINER
   ============================================================================ */

.login-container {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 1400px;
    min-height: 700px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.1),
        var(--shadow-2xl),
        0 0 100px rgba(0, 0, 0, 0.3);
    animation: containerSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ============================================================================
   LEFT SIDE - VISUAL SECTION
   ============================================================================ */

.login-visual {
    position: relative;
    padding: 80px 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--admin-gradient);
    overflow: hidden;
}

/* Animated gradient overlay */
.login-visual::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 40%);
    animation: gradientRotate 20s linear infinite;
}

@keyframes gradientRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Geometric shapes */
.login-visual::after {
    content: '';
    position: absolute;
    bottom: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    filter: blur(60px);
    animation: shapeFloat 8s ease-in-out infinite;
}

@keyframes shapeFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-30px, -30px) scale(1.1); }
}

/* Role-specific gradients */
.login-visual.enseignant {
    background: var(--enseignant-gradient);
}

.login-visual.etudiant {
    background: var(--etudiant-gradient);
}

.login-visual.super-admin {
    background: var(--super-admin-gradient);
}

/* Visual Content */
.visual-content {
    position: relative;
    z-index: 2;
}

.logo-section {
    margin-bottom: 60px;
    animation: logoFadeIn 1s ease-out 0.3s both;
}

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

.logo {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.2),
        0 20px 40px rgba(0, 0, 0, 0.2);
    transition: transform var(--transition-base);
}

.logo:hover {
    transform: translateY(-4px) scale(1.05);
}

.logo img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 16px;
}

.visual-title {
    font-family: 'Poppins', sans-serif;
    font-size: 56px;
    font-weight: 800;
    color: var(--white);
    line-height: 1.1;
    margin-bottom: 20px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.02em;
}

.visual-subtitle {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.6;
    font-weight: 400;
    max-width: 400px;
}

/* Features List */
.visual-features {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all var(--transition-base);
    animation: featureSlideIn 0.6s ease-out both;
}

.feature-item:nth-child(1) { animation-delay: 0.5s; }
.feature-item:nth-child(2) { animation-delay: 0.6s; }
.feature-item:nth-child(3) { animation-delay: 0.7s; }

@keyframes featureSlideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.feature-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: var(--white);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.feature-text {
    color: var(--white);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
}

/* ============================================================================
   RIGHT SIDE - FORM SECTION
   ============================================================================ */

.login-form-section {
    padding: 80px 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
    position: relative;
}

.login-form-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.form-header {
    margin-bottom: 48px;
    animation: formHeaderFadeIn 0.8s ease-out 0.4s both;
}

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

.form-title {
    font-family: 'Poppins', sans-serif;
    font-size: 40px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.form-subtitle {
    font-size: 16px;
    color: var(--gray-400);
    font-weight: 400;
}

/* ============================================================================
   ALERTS
   ============================================================================ */

.alert {
    padding: 16px 20px;
    border-radius: 14px;
    margin-bottom: 28px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: 14px;
    line-height: 1.6;
    backdrop-filter: blur(10px);
    border: 1px solid;
    animation: alertSlideIn 0.4s ease-out;
}

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

.alert i {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.3);
}

/* ============================================================================
   FORM ELEMENTS
   ============================================================================ */

form {
    animation: formFadeIn 0.8s ease-out 0.5s both;
}

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

.form-group {
    margin-bottom: 28px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-300);
    margin-bottom: 10px;
    letter-spacing: 0.01em;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    font-size: 20px;
    transition: color var(--transition-base);
    z-index: 2;
    pointer-events: none;
}

.form-input {
    width: 100%;
    padding: 16px 20px 16px 54px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    color: var(--white);
    transition: all var(--transition-base);
    font-weight: 500;
}

.form-input::placeholder {
    color: var(--gray-500);
}

.form-input:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
}

.form-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--admin-primary);
    box-shadow: 
        0 0 0 4px rgba(16, 185, 129, 0.1),
        0 10px 30px rgba(16, 185, 129, 0.15);
}

.form-input:focus ~ .input-icon {
    color: var(--admin-primary);
}

/* Role-specific focus colors */
.enseignant-page .form-input:focus {
    border-color: var(--enseignant-primary);
    box-shadow: 
        0 0 0 4px rgba(59, 130, 246, 0.1),
        0 10px 30px rgba(59, 130, 246, 0.15);
}

.enseignant-page .form-input:focus ~ .input-icon {
    color: var(--enseignant-primary);
}

.etudiant-page .form-input:focus {
    border-color: var(--etudiant-primary);
    box-shadow: 
        0 0 0 4px rgba(245, 158, 11, 0.1),
        0 10px 30px rgba(245, 158, 11, 0.15);
}

.etudiant-page .form-input:focus ~ .input-icon {
    color: var(--etudiant-primary);
}

.super-admin-page .form-input:focus {
    border-color: var(--super-admin-primary);
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.1),
        0 10px 30px rgba(102, 126, 234, 0.15);
}

.super-admin-page .form-input:focus ~ .input-icon {
    color: var(--super-admin-primary);
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--gray-500);
    font-size: 20px;
    z-index: 2;
    transition: color var(--transition-base);
    padding: 4px;
}

.password-toggle:hover {
    color: var(--gray-300);
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--admin-primary);
    border-radius: 6px;
}

.checkbox-label {
    font-size: 14px;
    color: var(--gray-400);
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast);
}

.checkbox-label:hover {
    color: var(--gray-300);
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn-login {
    width: 100%;
    padding: 18px 24px;
    background: var(--admin-gradient);
    color: var(--white);
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 10px 30px rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.btn-login::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;
}

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

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.15),
        0 15px 40px rgba(16, 185, 129, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

/* Role-specific buttons */
.btn-login.enseignant {
    background: var(--enseignant-gradient);
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 10px 30px rgba(59, 130, 246, 0.3);
}

.btn-login.enseignant:hover {
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.15),
        0 15px 40px rgba(59, 130, 246, 0.4);
}

.btn-login.etudiant {
    background: var(--etudiant-gradient);
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 10px 30px rgba(245, 158, 11, 0.3);
}

.btn-login.etudiant:hover {
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.15),
        0 15px 40px rgba(245, 158, 11, 0.4);
}

.btn-login.super-admin {
    background: var(--super-admin-gradient);
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 10px 30px rgba(102, 126, 234, 0.3);
}

.btn-login.super-admin:hover {
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.15),
        0 15px 40px rgba(102, 126, 234, 0.4);
}

/* ============================================================================
   FORM FOOTER
   ============================================================================ */

.form-footer {
    margin-top: 40px;
    text-align: center;
    padding-top: 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    animation: footerFadeIn 0.8s ease-out 0.7s both;
}

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

.switch-link {
    font-size: 14px;
    color: var(--gray-400);
    line-height: 1.6;
}

.switch-link a {
    color: var(--admin-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.switch-link a:hover {
    color: var(--admin-secondary);
    text-decoration: underline;
}

/* Role-specific link colors */
.enseignant-page .switch-link a {
    color: var(--enseignant-primary);
}

.enseignant-page .switch-link a:hover {
    color: var(--enseignant-secondary);
}

.etudiant-page .switch-link a {
    color: var(--etudiant-primary);
}

.etudiant-page .switch-link a:hover {
    color: var(--etudiant-secondary);
}

.super-admin-page .switch-link a {
    color: var(--super-admin-primary);
}

.super-admin-page .switch-link a:hover {
    color: var(--super-admin-secondary);
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 1200px) {
    .login-container {
        max-width: 1000px;
    }
    
    .login-visual,
    .login-form-section {
        padding: 60px 40px;
    }
    
    .visual-title {
        font-size: 48px;
    }
}

@media (max-width: 968px) {
    .login-container {
        grid-template-columns: 1fr;
        max-width: 550px;
        min-height: auto;
    }
    
    .login-visual {
        display: none;
    }
    
    .login-form-section {
        padding: 50px 40px;
    }
    
    .form-title {
        font-size: 32px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 15px;
    }
    
    .login-container {
        border-radius: 24px;
    }
    
    .login-form-section {
        padding: 40px 24px;
    }
    
    .form-title {
        font-size: 28px;
    }
    
    .form-subtitle {
        font-size: 14px;
    }
    
    .visual-title {
        font-size: 36px;
    }
    
    .feature-item {
        padding: 16px;
    }
    
    .feature-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    
    .feature-text {
        font-size: 14px;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

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

/* Focus visible for keyboard navigation */
.form-input:focus-visible,
.btn-login:focus-visible,
.checkbox-wrapper input:focus-visible {
    outline: 2px solid var(--admin-primary);
    outline-offset: 2px;
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    body::before,
    body::after,
    .login-visual::before,
    .login-visual::after {
        display: none;
    }
}
