/* ============================================
   register.css
   PAGE D'INSCRIPTION - STYLE MODERNISÉ
   ============================================ */

/* --- LAYOUT PRINCIPAL --- */
.register-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--bg-primary);
    position: relative;
    overflow-x: hidden;
    /* Empêche le scroll horizontal dû aux animations */
}

/* Fond grille (identique login) */
.register-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 20%, transparent 70%);
    z-index: 0;
}

/* Orbes animées (identique login) */
.register-page::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
    top: -100px;
    left: -100px;
    animation: float 12s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

/* --- CARD --- */
.register-card {
    position: relative;
    width: 100%;
    max-width: 520px;
    /* Plus large que le login pour les champs côte à côte */
    padding: 2.5rem;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 1;
    animation: cardAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Bordure supérieure animée */
.register-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary) 0%, #8b5cf6 50%, var(--accent-primary) 100%);
    background-size: 200% 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* --- HEADER --- */
.register-header {
    text-align: center;
    margin-bottom: 2rem;
}

.register-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.2);
}

.register-tagline {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* --- STEPS WIZARD --- */
.register-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    position: relative;
    padding: 0 10px;
}

/* Ligne de connexion */
.register-steps::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: var(--surface-light);
    z-index: 0;
}

.register-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
    width: 60px;
    /* Zone de clic/visuelle fixe pour centrage */
}

.register-step__circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-tertiary);
    transition: all 0.3s ease;
}

.register-step__label {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
    text-align: center;
    transition: color 0.3s ease;
    white-space: nowrap;
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
}

/* État Actif */
.register-step--active .register-step__circle {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.register-step--active .register-step__label {
    color: var(--accent-light);
}

/* État Complété */
.register-step--completed .register-step__circle {
    background: var(--surface-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.register-step--completed .register-step__label {
    color: var(--text-secondary);
}

/* --- SCREENS --- */
.register-screen {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.register-title {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

.register-subtitle {
    margin: 0 0 2rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: center;
    line-height: 1.5;
}

/* --- FORM SPECIFICS --- */
.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

/* Wrapper pour icône (Password eye) */
.input-wrapper {
    position: relative;
}

.input-action {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.input-action:hover {
    color: var(--text-primary);
    background: var(--surface-light);
}

.eye-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Password Meter */
.register-meter {
    margin-top: 12px;
    height: 4px;
    background: var(--surface-light);
    border-radius: 2px;
    overflow: hidden;
}

.register-meter i {
    display: block;
    height: 100%;
    width: 0;
    background: var(--error);
    transition: width 0.3s ease, background 0.3s ease;
}

/* Criteria List */
.register-criteria {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: grid;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.register-criteria li {
    display: flex;
    align-items: center;
    transition: color 0.2s ease;
}

.register-criteria li::before {
    content: '○';
    display: inline-block;
    width: 16px;
    margin-right: 6px;
    font-size: 10px;
}

.register-criteria li.valid {
    color: var(--success);
}

.register-criteria li.valid::before {
    content: '●';
    color: var(--success);
}

/* --- BIRTHDAY DROPDOWNS --- */
.birthday-selects {
    display: grid;
    grid-template-columns: 1fr 2fr 1.2fr;
    gap: 10px;
}

.birthday-dropdown {
    position: relative;
}

.birthday-dropdown-trigger {
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 12px;
    cursor: pointer;
    background: rgba(30, 41, 59, 0.4);
    /* Glass styling */
}

.birthday-dropdown-trigger[data-placeholder="true"] {
    color: var(--text-tertiary);
}

.birthday-dropdown-arrow {
    color: var(--text-tertiary);
    transition: transform 0.2s;
}

.birthday-dropdown.open .birthday-dropdown-arrow {
    transform: rotate(180deg);
    color: var(--accent-primary);
}

.birthday-dropdown.open .birthday-dropdown-trigger {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary);
}

.birthday-dropdown-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 240px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 100;
    overflow-y: auto;
    animation: dropdownSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.birthday-dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 1px solid var(--border-light);
}

.birthday-dropdown-item:last-child {
    border-bottom: none;
}

.birthday-dropdown-item:hover,
.birthday-dropdown-item.selected {
    background: var(--surface-hover);
    color: var(--accent-primary);
}

/* --- ACTIONS & PROMO --- */
.register-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.register-actions .btn {
    flex: 1;
}

.form-promo-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--success);
    margin-top: 8px;
    padding: 6px 10px;
    background: var(--success-light);
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* --- VERIFICATION SCREEN --- */
.register-verify {
    text-align: center;
    padding: 20px 0;
}

.register-verify__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05));
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
}

.register-verify__icon svg {
    width: 36px;
    height: 36px;
}

.register-verify__help {
    margin: 0 0 24px;
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

.register-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding: 12px 20px;
    background: var(--surface-light);
    border-radius: 99px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.register-spinner__circle {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.register-spinner__circle {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* --- FOOTER --- */
.register-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.register-footer a {
    color: var(--accent-light);
    text-decoration: none;
    font-weight: 500;
}

.register-footer a:hover {
    text-decoration: underline;
}

.register-footer__copy {
    margin-top: 2rem;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.8rem;
    opacity: 0.6;
}

/* Erreurs de formulaire */
.form-error {
    color: var(--error, #ef4444);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    min-height: 1.2em;
    display: none;
    /* Géré par le JS, mais par défaut caché */
    animation: slideIn 0.3s ease-out;
}

/* État désactivé pour les boutons */
.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--surface-light);
    /* ou une couleur neutre */
    color: var(--text-tertiary);
    pointer-events: none;
    /* Bloque définitivement les interactions */
    box-shadow: none;
}


/* Ajoute de l'espace entre les groupes de champs successifs */
.register-screen .form-group+.form-group,
.register-screen .form-row+.form-group {
    margin-top: 1.5rem;
}

/* 1. Fix Alignement Nom/Prénom
   Annule la marge du haut pour les champs qui sont côte à côte dans une "form-row" */
.form-row .form-group+.form-group {
    margin-top: 0;
}

/* 2. Fix Barre Supérieure
   On réduit sa largeur pour qu'elle ne touche plus les coins arrondis de la carte.
   On lui donne ses propres petits arrondis. */
.register-card::before {
    left: 10px;
    /* Décalage gauche */
    right: 10px;
    /* Décalage droite */
    top: 0;
    /* Reste collé en haut */
    width: auto;
    /* S'adapte aux marges left/right */
    border-radius: 0 0 4px 4px;
    /* Petits arrondis en bas de la barre pour le style */
}

/* Espace pour le bloc checkbox (conditions) */
.form-group--inline {
    margin-top: 1.5rem;
}

/* Style des liens dans le label de la checkbox */
.checkbox-label a {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.checkbox-label a:hover {
    color: var(--accent-light);
    text-decoration: none;
}


/* --- COUNTRY DROPDOWN SEARCH --- */
.country-dropdown .birthday-dropdown-list {
    padding-top: 0;
    overflow: hidden;
    /* Le display: flex est géré ci-dessous pour ne pas casser l'attribut hidden */
}

/* Applique flex uniquement quand la liste est visible */
.country-dropdown .birthday-dropdown-list:not([hidden]) {
    display: flex;
    flex-direction: column;
}

.dropdown-search-container {
    position: sticky;
    top: 0;
    background: var(--surface);
    padding: 8px;
    border-bottom: 1px solid var(--border-light);
    z-index: 10;
}

.dropdown-search-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.dropdown-search-input:focus {
    border-color: var(--accent-primary);
}

#country-options {
    overflow-y: auto;
    max-height: 200px;
}

/* --- RESPONSIVE --- */
@media (max-width: 600px) {
    .register-card {
        padding: 1.5rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
        /* Géré par le margin-bottom des groups */
    }

    .birthday-selects {
        grid-template-columns: 1fr 1.5fr 1fr;
    }

    .register-steps::before {
        left: 30px;
        right: 30px;
    }
}