/* ===== PAGE D'AUTHENTIFICATION MODERNE ===== */

/* Variables CSS pour cohérence */
:root {
    --auth-primary: #2563eb;
    --auth-primary-dark: #1d4ed8;
    --auth-secondary: #64748b;
    --auth-success: #10b981;
    --auth-warning: #f59e0b;
    --auth-error: #ef4444;
    --auth-bg: #f8fafc;
    --auth-card-bg: #ffffff;
    --auth-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --auth-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --auth-radius: 16px;
    --auth-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Background avec particules animées */
.auth-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: -1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.particle:nth-child(1) {
    left: 10%;
    top: 20%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    left: 80%;
    top: 80%;
    animation-delay: 1s;
}

.particle:nth-child(3) {
    left: 30%;
    top: 70%;
    animation-delay: 2s;
}

.particle:nth-child(4) {
    left: 90%;
    top: 30%;
    animation-delay: 3s;
}

.particle:nth-child(5) {
    left: 60%;
    top: 10%;
    animation-delay: 4s;
}

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

/* Container principal */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

/* Carte d'authentification */
.auth-card {
    background: var(--auth-card-bg);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow-lg);
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    position: relative;
    animation: slideUp 0.6s ease-out;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

/* Header de la carte */
.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    position: relative;
    overflow: hidden;
}

.auth-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    opacity: 0.1;
    animation: pulse 2s ease-in-out infinite;
}

.login-icon {
    background: linear-gradient(135deg, var(--auth-primary) 0%, #3b82f6 100%);
    color: white;
}

.login-icon::before {
    background: var(--auth-primary);
}

.register-icon {
    background: linear-gradient(135deg, var(--auth-success) 0%, #34d399 100%);
    color: white;
}

.register-icon::before {
    background: var(--auth-success);
}

.forgot-icon {
    background: linear-gradient(135deg, var(--auth-warning) 0%, #fbbf24 100%);
    color: white;
}

.forgot-icon::before {
    background: var(--auth-warning);
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.auth-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--auth-secondary);
    font-size: 0.95rem;
}

/* Groupes de formulaire */
.form-group {
    margin-bottom: 1.5rem;
}

/* Wrapper des inputs */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-secondary);
    z-index: 2;
    transition: var(--auth-transition);
}

.form-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--auth-transition);
    background: #f8fafc;
    color: #1f2937;
}

.form-group input:focus {
    outline: none;
    border-color: var(--auth-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input:focus + .input-icon {
    color: var(--auth-primary);
}

/* Bouton de toggle du mot de passe */
.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--auth-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--auth-transition);
}

.password-toggle:hover {
    color: var(--auth-primary);
    background: rgba(37, 99, 235, 0.1);
}

/* Validation des inputs */
.input-validation {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.input-wrapper.valid .input-validation {
    display: flex;
    background: var(--auth-success);
    color: white;
}

.input-wrapper.invalid .input-validation {
    display: flex;
    background: var(--auth-error);
    color: white;
}

.input-wrapper.valid .input-validation::after {
    content: '✓';
}

.input-wrapper.invalid .input-validation::after {
    content: '✗';
}

/* Force du mot de passe */
.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: var(--auth-transition);
}

.strength-fill.weak {
    width: 25%;
    background: var(--auth-error);
}

.strength-fill.fair {
    width: 50%;
    background: var(--auth-warning);
}

.strength-fill.good {
    width: 75%;
    background: #3b82f6;
}

.strength-fill.strong {
    width: 100%;
    background: var(--auth-success);
}

.strength-text {
    font-size: 0.8rem;
    color: var(--auth-secondary);
}

/* Options du formulaire */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Checkbox personnalisée */
.remember-me, .terms-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #4b5563;
}

.remember-me input, .terms-checkbox input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    margin-right: 0.5rem;
    position: relative;
    transition: var(--auth-transition);
}

.remember-me input:checked + .checkmark,
.terms-checkbox input:checked + .checkmark {
    background: var(--auth-primary);
    border-color: var(--auth-primary);
}

.checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: var(--auth-transition);
}

.remember-me input:checked + .checkmark::after,
.terms-checkbox input:checked + .checkmark::after {
    opacity: 1;
}

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

.forgot-link:hover {
    color: var(--auth-primary-dark);
    text-decoration: underline;
}

/* Boutons */
.auth-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--auth-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-btn.primary {
    background: linear-gradient(135deg, var(--auth-primary) 0%, #3b82f6 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.auth-btn.primary:hover {
    background: linear-gradient(135deg, var(--auth-primary-dark) 0%, var(--auth-primary) 100%);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

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

/* Loader du bouton */
.btn-loader {
    display: none;
    margin-left: 0.5rem;
}

.btn-loader .loader {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.auth-btn.loading .btn-text {
    opacity: 0.7;
}

.auth-btn.loading .btn-loader {
    display: block;
}

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

/* Divider */
.auth-divider {
    position: relative;
    text-align: center;
    margin: 2rem 0;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
}

.auth-divider span {
    background: white;
    color: var(--auth-secondary);
    padding: 0 1rem;
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

/* Connexion sociale */
.social-login {
    margin-bottom: 2rem;
}

.social-btn {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    color: #374151;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: var(--auth-transition);
    margin-bottom: 1rem;
}

.social-btn:hover {
    border-color: #d1d5db;
    background: #f9fafb;
    transform: translateY(-1px);
}

/* Liens d'authentification */
.auth-links {
    text-align: center;
    font-size: 0.95rem;
    color: #6b7280;
}

.auth-links a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--auth-transition);
}

.auth-links a:hover {
    color: var(--auth-primary-dark);
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .auth-container {
        padding: 1rem;
    }
    
    .auth-card {
        padding: 2rem;
        margin: 1rem 0;
    }
    
    .auth-header h1 {
        font-size: 1.75rem;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.5rem;
    }
    
    .auth-header {
        margin-bottom: 2rem;
    }
    
    .auth-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 1rem;
    }
    
    .auth-header h1 {
        font-size: 1.5rem;
    }
    
    .auth-btn {
        font-size: 1rem;
        padding: 14px 24px;
    }
    
    /* Message SSL plus compact sur mobile */
    .auth-card form + p {
        font-size: 0.8rem !important;
        line-height: 1.4;
        padding: 0 0.5rem;
    }
}

/* Animation d'entrée pour les formulaires */
.auth-card {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* États de validation */
.form-group input.valid {
    border-color: var(--auth-success);
    background: rgba(16, 185, 129, 0.05);
}

.form-group input.invalid {
    border-color: var(--auth-error);
    background: rgba(239, 68, 68, 0.05);
}

/* Messages d'erreur */
.error-message {
    color: var(--auth-error);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: none;
}

.error-message.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

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

/* Mode sombre (optionnel) */
@media (prefers-color-scheme: dark) {
    .auth-card {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .auth-header h1 {
        color: #f9fafb;
    }
    
    .form-group input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .form-group input:focus {
        background: #4b5563;
    }
    
    .social-btn {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .auth-divider span {
        background: #1f2937;
    }
}