/* =================================
   COMPOSANT BEM: c-auth-form
   Formulaires d'authentification réutilisables
   ================================= */

/* =================================
   1. VARIABLES DU COMPOSANT
   ================================= */
:root {
    /* Utilisation des couleurs normalisées */
    --auth-primary: var(--primary);
    --auth-primary-dark: var(--primary-dark);
    --auth-bg-light: var(--background);
    --auth-bg-dark: var(--background-light);

    /* Ombres et effets */
    --auth-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --auth-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --auth-border-radius: 16px;
    --auth-transition: all 0.3s ease;

    /* Effets visuels */
    --auth-glass-bg: rgba(255, 255, 255, 0.95);
    --auth-glass-border: rgba(255, 255, 255, 0.3);
}

/* =================================
   2. COMPOSANT: CARTE AUTH
   ================================= */
.c-auth-form {
    background: var(--auth-glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--auth-glass-border);
    border-radius: var(--auth-border-radius);
    padding: 3rem 2.5rem;
    box-shadow: var(--auth-shadow);
    animation: fadeIn 0.6s ease-out;
}

/* Container plus large pour l'inscription */
.c-auth-form--register {
    max-width: 500px;
}

/* =================================
   3. EN-TÊTE DU COMPOSANT
   ================================= */
.c-auth-form__header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.c-auth-form__icon {
    font-size: 1rem;
    color: var(--auth-primary);
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

.c-auth-form__title {
    color: var(--text);
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.c-auth-form__subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* =================================
   4. GROUPE DE CHAMPS
   ================================= */
.c-auth-form__group {
    margin-bottom: 1.25rem;
}

.c-auth-form__input {
    width: 100%;
    background: white;
    border: 2px solid transparent;
    background-image: linear-gradient(white, white), linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    border-radius: 12px;
    font-size: 1rem;
    color: var(--text);
    transition: var(--auth-transition);
    cursor: text !important;
    caret-color: #3182ce !important;
}

.c-auth-form__input:focus {
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.25);
    outline: none;
}

.c-auth-form__input::placeholder {
    color: #A0AEC0;
}

/* États de validation */
.c-auth-form__input,
.c-auth-form__input:valid,
.c-auth-form__input:invalid,
.c-auth-form__input.is-valid,
.c-auth-form__input.is-invalid {
    border: 2px solid transparent;
    background-image: linear-gradient(white, white), linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

/* Champs invalides avec icône */
.c-auth-form__input.is-invalid {
    padding-right: calc(1.5em + 0.75rem) !important;
    background-image:
        url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%231976d2'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%231976d2' stroke='none'/%3e%3c/svg%3e"),
        linear-gradient(white, white),
        linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    background-repeat: no-repeat, repeat, repeat;
    background-position: right 0.75rem center, 0 0, 0 0;
    background-size: 1rem auto, 100% 100%, 100% 100%;
    background-origin: content-box, padding-box, border-box;
    background-clip: padding-box, padding-box, border-box;
}

.c-auth-form__input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.25);
}

/* =================================
   5. CHECKBOX
   ================================= */
.c-auth-form__checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1.25rem 0;
}

.c-auth-form__checkbox {
    width: 1.2rem;
    height: 1.2rem;
    margin-top: 0;
    border: 2px solid #CBD5E0;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--auth-transition);
    background-color: white;
    position: relative;
    -webkit-appearance: none;
    appearance: none;
}

.c-auth-form__checkbox:checked {
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    border-color: #3182ce;
}

.c-auth-form__checkbox:checked::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    color: white;
    font-size: 0.7rem;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.c-auth-form__checkbox:focus {
    border-color: var(--auth-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(49, 130, 206, 0.25) !important;
}

.c-auth-form__checkbox-label {
    color: #64748B;
    font-size: 0.9rem;
    cursor: pointer;
}

/* =================================
   6. BOUTONS
   ================================= */
.c-auth-form__submit {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--auth-transition);
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.c-auth-form__submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.c-auth-form__submit i {
    font-size: 1.1rem;
}

.c-auth-form__submit--secondary {
    background: transparent;
    border: 2px solid var(--auth-primary);
    color: var(--auth-primary);
}

.c-auth-form__submit--secondary:hover {
    background: rgba(33, 150, 243, 0.1);
}

/* Bouton retour */
.c-auth-form__back {
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    color: var(--auth-primary);
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--auth-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.c-auth-form__back:hover {
    color: var(--auth-primary-dark);
    background: rgba(33, 150, 243, 0.05);
    text-decoration: underline;
}

.c-auth-form__back i {
    font-size: 0.9rem;
}

/* =================================
   7. LIENS
   ================================= */
.c-auth-form__links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #EDF2F7;
    font-size: 0.9rem;
}

.c-auth-form__link {
    color: var(--auth-primary) !important;
    text-decoration: none;
    transition: var(--auth-transition);
    font-weight: 500;
}

.c-auth-form__link:hover,
.c-auth-form__link:focus,
.c-auth-form__link:active {
    color: var(--auth-primary-dark) !important;
    text-decoration: underline;
}

/* =================================
   8. MESSAGES
   ================================= */
.c-auth-form__messages {
    margin-bottom: 1.5rem;
}

.c-auth-form__message {
    padding: 1rem;
    border-radius: 8px;
    background-color: rgba(49, 130, 206, 0.1);
    color: var(--auth-primary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(49, 130, 206, 0.2);
}

.c-auth-form__message--success {
    background-color: rgba(49, 130, 206, 0.1);
    color: var(--auth-primary);
    border-color: rgba(49, 130, 206, 0.2);
}

/* =================================
   9. FORMULAIRE MULTI-ÉTAPES
   ================================= */
.c-auth-form__progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin: 2rem 0;
}

.c-auth-form__progress::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--auth-glass-border);
    transform: translateY(-50%);
    z-index: 1;
}

.c-auth-form__step {
    position: relative;
    z-index: 2;
    background: white;
    padding: 0 0.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.c-auth-form__step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--auth-glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.c-auth-form__step-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.c-auth-form__step--active .c-auth-form__step-number {
    background: var(--auth-primary);
    border-color: var(--auth-primary);
    color: white;
}

.c-auth-form__step--active .c-auth-form__step-label {
    color: var(--auth-primary);
    font-weight: 600;
}

.c-auth-form__step--completed .c-auth-form__step-number {
    background: var(--auth-primary);
    border-color: var(--auth-primary);
    color: white;
}

.c-auth-form__step--completed .c-auth-form__step-number::after {
    content: '✓';
    font-size: 0.875rem;
}

/* =================================
   10. FORCE DU MOT DE PASSE
   ================================= */
.c-auth-form__password-strength {
    height: 4px;
    background: var(--auth-glass-border);
    border-radius: 2px;
    overflow: hidden;
}

.c-auth-form__strength-bar {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.c-auth-form__strength-bar--weak { background: #dc3545; }
.c-auth-form__strength-bar--medium { background: #ffc107; }
.c-auth-form__strength-bar--good { background: #17a2b8; }
.c-auth-form__strength-bar--strong { background: #28a745; }

/* =================================
   11. RÉCAPITULATIF
   ================================= */
.c-auth-form__recap {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 1rem;
}

.c-auth-form__recap-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--auth-glass-border);
}

.c-auth-form__recap-item:last-child {
    border-bottom: none;
}

/* =================================
   12. ANIMATIONS
   ================================= */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* =================================
   13. RESPONSIVE
   ================================= */
@media (max-height: 700px) {
    .c-auth-form {
        padding: 2rem 1.5rem;
    }

    .c-auth-form__header {
        margin-bottom: 1.5rem;
    }
}

@media (max-height: 600px) {
    .c-auth-form {
        padding: 1.5rem 1rem;
    }

    .c-auth-form__header {
        margin-bottom: 1rem;
    }

    .c-auth-form__group {
        margin-bottom: 0.75rem;
    }
}
