/* Styles pour les interfaces d'authentification professionnelles */

/* Variables CSS */
:root {
    --auth-primary: #667eea;
    --auth-secondary: #764ba2;
    --auth-success: #10b981;
    --auth-warning: #f59e0b;
    --auth-danger: #ef4444;
    --auth-info: #3b82f6;
    --auth-light: #f8fafc;
    --auth-dark: #1e293b;
    --auth-gray: #64748b;
    --auth-border: #e2e8f0;
    --auth-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --auth-radius: 12px;
    --auth-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset pour les pages d'auth */
* {
    box-sizing: border-box;
}

body.auth-body {
    margin: 0;
    padding: 0;
    overflow: auto;
    min-height: 100vh;
    width: 100vw;
    overflow-x: hidden;
}

html.auth-html {
    overflow: auto;
    min-height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body.auth-body .header,
body.auth-body .footer {
    display: none;
}

/* Masquer les messages d'erreur/succès sur les pages d'auth */
body.auth-body .alert {
    display: none !important;
}

body.auth-body .main {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100vw;
    overflow-x: hidden;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-secondary) 100%);
    padding: 20px;
    width: 100vw;
    margin: 0;
    box-sizing: border-box;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
}

/* S'assurer que le background couvre tout l'écran */
.auth-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-secondary) 100%);
    z-index: -1;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

/* Background animé */
.auth-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 1;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

.auth-shapes {
    position: relative;
    width: 100%;
    height: 100%;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 6s ease-in-out infinite;
}

.shape-1 {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 120px;
    height: 120px;
    top: 60%;
    right: 15%;
    animation-delay: 2s;
}

.shape-3 {
    width: 60px;
    height: 60px;
    bottom: 20%;
    left: 20%;
    animation-delay: 4s;
}

.shape-4 {
    width: 100px;
    height: 100px;
    top: 30%;
    right: 30%;
    animation-delay: 1s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

/* Container principal */
.auth-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: auto;
}

/* Carte d'authentification */
.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow);
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    margin: 0;
    width: 100%;
    max-width: 400px;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--auth-primary), var(--auth-secondary));
}

/* Header avec logo */
.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
}

.auth-logo i {
    font-size: 32px;
    color: var(--auth-primary);
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--auth-dark);
    margin: 0;
}

.auth-subtitle {
    color: var(--auth-gray);
    font-size: 14px;
    margin: 0;
    font-weight: 500;
}

/* Formulaire */
.auth-form {
    margin-bottom: 30px;
}

.form-header {
    text-align: center;
    margin-bottom: 30px;
}

.form-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--auth-dark);
    margin: 0 0 8px 0;
}

.form-header p {
    color: var(--auth-gray);
    font-size: 14px;
    margin: 0;
}

/* Message d'erreur du formulaire */
.form-error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    display: none; /* Masqué par défaut */
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

/* Quand le message est affiché */
.form-error-message.show {
    display: flex !important;
}

.form-error-message i {
    font-size: 16px;
    color: #dc2626;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group {
    margin-bottom: 24px;
}

/* Wrapper d'input avec icône */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-gray);
    font-size: 16px;
    z-index: 2;
    transition: var(--auth-transition);
}

.input-wrapper input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    border: 2px solid var(--auth-border);
    border-radius: var(--auth-radius);
    font-size: 16px;
    background: white;
    transition: var(--auth-transition);
    outline: none;
    position: relative;
    z-index: 1;
}

.input-wrapper input:required:invalid {
    box-shadow: none;
}

.input-wrapper input::placeholder {
    opacity: 0;
    color: transparent;
    font-size: 0;
}

/* Focus sur l'input */
.input-wrapper input:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Label au repos - reste dans l'input */
.input-wrapper input:not(:focus) + .input-label {
    transform: translateY(0) scale(1);
    color: var(--auth-gray);
    background: transparent;
    padding: 0;
    z-index: 2;
    font-weight: 500;
}

/* Label actif - se déplace au-dessus (focus) */
.input-wrapper input:focus + .input-label {
    transform: translateY(-28px) scale(0.85);
    color: var(--auth-primary);
    background: white;
    padding: 2px 8px;
    z-index: 3;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

/* Label avec contenu - reste au-dessus même sans focus */
.input-wrapper input:not(:placeholder-shown) + .input-label {
    transform: translateY(-28px) scale(0.85);
    color: var(--auth-primary);
    background: white;
    padding: 2px 8px;
    z-index: 3;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

.input-label {
    position: absolute;
    left: 48px;
    top: 16px;
    color: var(--auth-gray);
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 2;
    background: transparent;
    padding: 0;
    border-radius: 4px;
    line-height: 1;
    white-space: nowrap;
    transform-origin: left center;
}

/* Bouton de toggle du mot de passe */
.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--auth-gray);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--auth-transition);
    z-index: 5;
}

.password-toggle:hover {
    color: var(--auth-primary);
    background: rgba(102, 126, 234, 0.1);
}

/* Indicateur de force du mot de passe */
.password-strength {
    margin-top: 8px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.strength-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid #d1d5db;
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: all 0.4s ease;
    border-radius: 3px;
    background: transparent;
    display: block;
    min-height: 6px;
}

.strength-fill.weak {
    width: 25% !important;
    background: #c084fc !important;
    background-color: #c084fc !important;
    border: 2px solid #a855f7 !important;
    border-color: #a855f7 !important;
}

.strength-fill.fair {
    width: 50% !important;
    background: #a855f7 !important;
    background-color: #a855f7 !important;
    border: 2px solid #9333ea !important;
    border-color: #9333ea !important;
}

.strength-fill.good {
    width: 75% !important;
    background: #7c3aed !important;
    background-color: #7c3aed !important;
    border: 2px solid #6d28d9 !important;
    border-color: #6d28d9 !important;
}

.strength-fill.strong {
    width: 100% !important;
    background: #5b21b6 !important;
    background-color: #5b21b6 !important;
    border: 2px solid #4c1d95 !important;
    border-color: #4c1d95 !important;
}

.strength-text {
    font-size: 12px;
    color: var(--auth-gray);
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.strength-text.weak {
    color: #a855f7;
    font-weight: 600;
}

.strength-text.fair {
    color: #9333ea;
    font-weight: 600;
}

.strength-text.good {
    color: #6d28d9;
    font-weight: 600;
}

.strength-text.strong {
    color: #4c1d95;
    font-weight: 600;
}

/* Validation des champs - styles pour les états valid/invalid */

.input-wrapper.invalid input {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-wrapper.valid input {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Validation des cases à cocher */
.checkbox-wrapper.invalid .checkmark {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.checkbox-wrapper.valid .checkmark {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Icône de validation */
.validation-icon {
    position: absolute !important;
    right: 50px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 16px !important;
    z-index: 999 !important;
    opacity: 0 !important;
    transition: all 0.3s ease !important;
    animation: pulse 0.3s ease-in-out !important;
    background: white !important;
    border-radius: 50% !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

@keyframes pulse {
    0% { transform: translateY(-50%) scale(0.8); }
    50% { transform: translateY(-50%) scale(1.1); }
    100% { transform: translateY(-50%) scale(1); }
}

/* Ajustement pour les champs avec bouton toggle */
.input-wrapper:has(.password-toggle) .validation-icon {
    right: 80px;
}

/* Ajustement pour les cases à cocher */
.checkbox-wrapper .validation-icon {
    right: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.validation-icon.show {
    opacity: 1 !important;
}

.validation-icon.invalid {
    color: #ef4444 !important;
}

.validation-icon.valid {
    color: #10b981 !important;
}

/* Options du formulaire */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

/* Checkbox personnalisée */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--auth-border);
    border-radius: 4px;
    position: relative;
    transition: var(--auth-transition);
    flex-shrink: 0;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark {
    background: var(--auth-primary);
    border-color: var(--auth-primary);
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label {
    color: var(--auth-gray);
    font-weight: 500;
}

.terms-link {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 600;
}

.terms-link:hover {
    text-decoration: underline;
}

.forgot-password {
    color: var(--auth-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--auth-transition);
}

.forgot-password:hover {
    text-decoration: underline;
}

/* Boutons */
.btn-full {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--auth-radius);
    cursor: pointer;
    transition: var(--auth-transition);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Footer d'authentification */
.auth-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--auth-border);
}

.auth-footer p {
    color: var(--auth-gray);
    font-size: 14px;
    margin: 0 0 12px 0;
}

.auth-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--auth-transition);
    background: rgba(102, 126, 234, 0.1);
}

.auth-link:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-1px);
}


/* Responsive */
@media (max-width: 768px) {
    .auth-page {
        padding: 20px 15px;
    }
    
    .auth-card {
        margin: 0;
    }
}

@media (max-width: 480px) {
    .auth-page {
        padding: 15px 10px;
    }
    
    .auth-card {
        padding: 30px 20px;
        margin: 0;
        width: 100%;
        max-width: 100%;
    }
    
    .auth-logo h1 {
        font-size: 24px;
    }
    
    .form-header h2 {
        font-size: 20px;
    }
    
    .input-wrapper input {
        padding: 14px 14px 14px 44px;
        font-size: 16px; /* Empêche le zoom sur iOS */
    }
    
    .input-icon {
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 14px;
    }
    
    .input-label {
        left: 44px;
        top: 14px;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
}

/* Animations d'entrée */
.auth-card {
    animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* États de validation */
.input-wrapper input.valid {
    border-color: var(--auth-success);
}

.input-wrapper input.invalid {
    border-color: var(--auth-danger);
}

.input-wrapper input.valid:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.input-wrapper input.invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Messages d'erreur - masqués, on utilise seulement les icônes */
.error-message {
    display: none !important;
}

/* Masquer les messages d'erreur du navigateur */
input:invalid {
    box-shadow: none !important;
}

input:invalid:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

/* Masquer les tooltips d'erreur du navigateur */
input:invalid::before {
    display: none !important;
}

/* Désactiver les messages d'erreur natifs */
input:invalid::-webkit-validation-bubble-message {
    display: none !important;
}

input:invalid::-webkit-validation-bubble {
    display: none !important;
}

/* Loading state */
.btn-primary.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Règles spécifiques pour forcer l'affichage des couleurs violettes */
.password-strength .strength-fill.weak {
    background: #c084fc !important;
    background-color: #c084fc !important;
    border-color: #a855f7 !important;
}

.password-strength .strength-fill.fair {
    background: #a855f7 !important;
    background-color: #a855f7 !important;
    border-color: #9333ea !important;
}

.password-strength .strength-fill.good {
    background: #7c3aed !important;
    background-color: #7c3aed !important;
    border-color: #6d28d9 !important;
}

.password-strength .strength-fill.strong {
    background: #5b21b6 !important;
    background-color: #5b21b6 !important;
    border-color: #4c1d95 !important;
}
