/**
 * Modern Login Page - Styles CSS
 * Version: 1.0.0
 * Pages: Login, Register, Password Reset
 */

/* ============================================
   VARIABLES CSS
   ============================================ */
:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338ca;
    --background-color: #1E293B;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --error-color: #ef4444;
    --success-color: #10b981;
    --border-radius: 8px;
    --transition: all 0.2s ease;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
body.login {
    background: white !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
}

#login {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

.login form,
.login #registerform,
.login #lostpasswordform {
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
}

/* ============================================
   LAYOUT - SPLIT SCREEN
   ============================================ */
.mlp-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Partie gauche - Formulaires */
.mlp-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Partie droite - Branding */
.mlp-right {
    flex: 1;
    background: var(--background-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* ============================================
   BRANDING (Côté droit)
   ============================================ */
.mlp-brand {
    color: white;
    text-align: center;
    z-index: 10;
    position: relative;
}

.mlp-brand-logo {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 28px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.mlp-brand-name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.mlp-brand-subtitle {
    font-size: 0.95rem;
    opacity: 0.8;
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ============================================
   NAVIGATION
   ============================================ */
.mlp-back-link {
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    transition: var(--transition);
    font-weight: 500;
}

.mlp-back-link:hover {
    color: var(--primary-color);
    transform: translateX(-4px);
}

/* ============================================
   TITRES ET SOUS-TITRES
   ============================================ */
.mlp-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.mlp-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.5;
}

/* ============================================
   BOUTONS DE CONNEXION SOCIALE
   ============================================ */
.mlp-social-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.mlp-social-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
}

.mlp-social-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

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

.mlp-social-btn i {
    font-size: 1.1rem;
}

/* ============================================
   DIVIDER "OU"
   ============================================ */
.mlp-divider {
    text-align: center;
    margin: 2rem 0;
    position: relative;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.mlp-divider::before,
.mlp-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background: var(--border-color);
}

.mlp-divider::before {
    left: 0;
}

.mlp-divider::after {
    right: 0;
}

/* ============================================
   FORMULAIRES
   ============================================ */
.mlp-form-group {
    margin-bottom: 1.5rem;
}

/* Labels */
.mlp-label {
    display: block;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.mlp-label span {
    color: var(--error-color);
}

/* Champs de saisie - Login */
#loginform input[type="text"],
#loginform input[type="password"],
#loginform input[type="email"],
#registerform input[type="text"],
#registerform input[type="email"],
#lostpasswordform input[type="text"],
#lostpasswordform input[type="email"] {
    width: 100% !important;
    padding: 0.75rem 1rem !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius) !important;
    font-size: 1rem !important;
    transition: var(--transition) !important;
    box-shadow: none !important;
    background: white !important;
    color: var(--text-primary) !important;
}

#loginform input[type="text"]:focus,
#loginform input[type="password"]:focus,
#loginform input[type="email"]:focus,
#registerform input[type="text"]:focus,
#registerform input[type="email"]:focus,
#lostpasswordform input[type="text"]:focus,
#lostpasswordform input[type="email"]:focus {
    outline: none !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1) !important;
}

#loginform input::placeholder,
#registerform input::placeholder,
#lostpasswordform input::placeholder {
    color: var(--text-muted);
}

/* ============================================
   CHECKBOX & LIENS
   ============================================ */
.mlp-checkbox-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

#loginform .forgetmenot,
#registerform .forgetmenot {
    margin: 0 !important;
    display: flex;
    align-items: center;
}

#loginform label,
#registerform label,
#lostpasswordform label {
    color: var(--text-secondary) !important;
    font-size: 0.9rem !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    cursor: pointer;
}

#loginform input[type="checkbox"],
#registerform input[type="checkbox"] {
    margin-right: 0.5rem !important;
    width: 16px !important;
    height: 16px !important;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Lien mot de passe oublié */
.mlp-forgot-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
    font-weight: 500;
}

.mlp-forgot-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* ============================================
   BOUTONS DE SOUMISSION
   ============================================ */
#loginform .submit,
#registerform .submit,
#lostpasswordform .submit {
    margin: 0 !important;
    padding: 0 !important;
}

#loginform input[type="submit"],
#registerform input[type="submit"],
#lostpasswordform input[type="submit"] {
    width: 100% !important;
    padding: 0.875rem !important;
    background: var(--primary-color) !important;
    border: none !important;
    border-radius: var(--border-radius) !important;
    color: white !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    cursor: pointer !important;
    transition: var(--transition) !important;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2) !important;
}

#loginform input[type="submit"]:hover,
#registerform input[type="submit"]:hover,
#lostpasswordform input[type="submit"]:hover {
    background: var(--primary-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(79, 70, 229, 0.3) !important;
}

#loginform input[type="submit"]:active,
#registerform input[type="submit"]:active,
#lostpasswordform input[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2) !important;
}

/* État désactivé */
.login .button-primary.disabled,
.login .button-primary:disabled,
.login .button-primary[disabled] {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* ============================================
   SECTION INSCRIPTION / LIENS ALTERNATIFS
   ============================================ */
.mlp-signup {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.mlp-signup a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.mlp-signup a:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* ============================================
   PATTERN DÉCORATIF (Côté droit)
   ============================================ */
.mlp-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.05;
}

.mlp-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2rem;
    transform: rotate(-12deg) scale(1.2);
    padding: 4rem;
}

.mlp-grid-item {
    width: 100%;
    padding-bottom: 100%;
    background: white;
    border-radius: var(--border-radius);
    animation: float 10s ease-in-out infinite;
}

.mlp-grid-item:nth-child(odd) {
    animation-delay: -5s;
}

.mlp-grid-item:nth-child(3n) {
    animation-delay: -3s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
        opacity: 1;
    }
    50% {
        transform: translateY(-20px);
        opacity: 0.6;
    }
}

/* ============================================
   MESSAGES D'ERREUR ET DE SUCCÈS
   ============================================ */
#login_error,
.message,
.login .success {
    border-left: 4px solid var(--error-color) !important;
    background: #fef2f2 !important;
    padding: 1rem !important;
    margin-bottom: 1.5rem !important;
    border-radius: var(--border-radius) !important;
    box-shadow: none !important;
    color: #991b1b !important;
    font-size: 0.95rem !important;
}

.message,
.login .success {
    border-left-color: var(--success-color) !important;
    background: #f0fdf4 !important;
    color: #065f46 !important;
}

#login_error a,
.message a,
.login .success a {
    color: inherit !important;
    text-decoration: underline !important;
}

#login_error strong {
    display: block;
    margin-bottom: 0.5rem;
}

/* ============================================
   NAVIGATION WORDPRESS (Cachée)
   ============================================ */
#nav,
#backtoblog {
    display: none !important;
}

/* ============================================
   ANIMATIONS D'ENTRÉE
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mlp-left > * {
    animation: fadeInUp 0.5s ease-out backwards;
}

.mlp-left > *:nth-child(1) { animation-delay: 0.1s; }
.mlp-left > *:nth-child(2) { animation-delay: 0.2s; }
.mlp-left > *:nth-child(3) { animation-delay: 0.3s; }
.mlp-left > *:nth-child(4) { animation-delay: 0.4s; }
.mlp-left > *:nth-child(5) { animation-delay: 0.5s; }
.mlp-left > *:nth-child(6) { animation-delay: 0.6s; }

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

.mlp-brand {
    animation: fadeIn 0.8s ease-out 0.3s backwards;
}

/* ============================================
   ACCESSIBILITÉ
   ============================================ */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Lecteurs d'écran uniquement */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    color: #21759b;
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

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

/* Tablettes et plus petit */
@media (max-width: 1024px) {
    .mlp-right {
        display: none;
    }
    
    .mlp-left {
        max-width: 500px;
        margin: 0 auto;
    }
}

/* Mobile large */
@media (max-width: 768px) {
    .mlp-left {
        padding: 2.5rem 2rem;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .mlp-left {
        padding: 2rem 1.5rem;
    }
    
    .mlp-social-buttons {
        flex-direction: column;
    }
    
    .mlp-title {
        font-size: 1.75rem;
    }
    
    .mlp-brand-name {
        font-size: 1.5rem;
    }
    
    .mlp-checkbox-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .mlp-social-btn {
        font-size: 0.9rem;
    }
}

/* Mobile petit */
@media (max-width: 480px) {
    .mlp-left {
        padding: 1.5rem 1rem;
    }
    
    .mlp-title {
        font-size: 1.5rem;
    }
    
    .mlp-subtitle {
        font-size: 0.9rem;
    }
    
    .mlp-social-btn {
        padding: 0.625rem 0.875rem;
    }
    
    #loginform input[type="text"],
    #loginform input[type="password"],
    #loginform input[type="email"],
    #registerform input[type="text"],
    #registerform input[type="email"],
    #lostpasswordform input[type="text"],
    #lostpasswordform input[type="email"] {
        font-size: 16px !important; /* Évite le zoom sur iOS */
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .mlp-right,
    .mlp-social-buttons,
    .mlp-back-link,
    .mlp-pattern {
        display: none !important;
    }
    
    body.login {
        background: white !important;
    }
    
    .mlp-container {
        display: block;
    }
    
    .mlp-left {
        max-width: 100%;
        padding: 1rem;
    }
}

/* ============================================
   STYLES SPÉCIFIQUES AUX PAGES
   ============================================ */

/* Page d'inscription - Espacement supplémentaire */
body.login.wp-core-ui #registerform .input {
    margin-bottom: 1rem;
}

/* Page de réinitialisation - Message d'info */
#lostpasswordform p.description {
    color: var(--text-secondary) !important;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    line-height: 1.5;
}

/* Loader pendant la soumission */
.mlp-loading {
    position: relative;
    pointer-events: none;
}

.mlp-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ============================================
   DARK MODE (Optionnel)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Vous pouvez ajouter des styles pour le mode sombre ici */
    /* Exemple:
    body.login {
        background: #1a1a1a !important;
    }
    */
}

/* ============================================
   UTILITIES
   ============================================ */
.mlp-hidden {
    display: none !important;
}

.mlp-text-center {
    text-align: center;
}

.mlp-mt-1 { margin-top: 0.5rem; }
.mlp-mt-2 { margin-top: 1rem; }
.mlp-mt-3 { margin-top: 1.5rem; }

.mlp-mb-1 { margin-bottom: 0.5rem; }
.mlp-mb-2 { margin-bottom: 1rem; }
.mlp-mb-3 { margin-bottom: 1.5rem; }