/*
================================================================
INSCRIPTION (register.php)
----------------------------------------------------------------
Sans JavaScript : toutes les étapes sont visibles, le bouton
"Créer ma carte" suffit. Avec JavaScript (.is-js) : parcours en
3 étapes avec validation en direct.
================================================================
*/

.rg-page {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: 32px;
}

.rg-card {
    max-width: 480px;
    padding: 22px 18px 24px;
}

@media (min-width: 576px) {
    .rg-page { align-items: center; }
    .rg-card { padding: 32px 30px; }
}

/* ---------- En-tête ---------- */

.rg-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.rg-logo {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.35);
    flex: 0 0 56px;
}

.rg-kicker {
    margin: 0 0 2px;
    color: var(--gold);
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.rg-title {
    margin: 0;
    color: #fff;
    font-size: clamp(1.6rem, 7vw, 2rem);
    font-weight: 900;
    letter-spacing: -0.8px;
    line-height: 1.05;
}

/* ---------- Aperçu de la carte ---------- */

.rg-perk-card {
    position: relative;
    overflow: hidden;
    padding: 16px;
    margin-bottom: 14px;
    border-radius: 22px;
    background:
        radial-gradient(circle at 100% 0%, rgba(255,255,255,0.35), transparent 42%),
        linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #111;
    box-shadow: 0 16px 36px rgba(255,152,0,0.22);
}

.rg-perk-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.rg-perk-label {
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    opacity: 0.75;
}

.rg-perk-reward {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(17,17,17,0.88);
    color: var(--gold);
    font-size: 0.74rem;
    font-weight: 900;
    white-space: nowrap;
}

.rg-perk-dots {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
}

.rg-perk-dots span {
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgba(17,17,17,0.14);
    border: 1.5px dashed rgba(17,17,17,0.28);
}

.rg-perk-dots span.is-on {
    background: #111;
    border: none;
    box-shadow: inset 0 0 0 3px rgba(255,193,7,0.9);
}

.rg-perk-dots span.is-goal {
    display: flex;
    align-items: center;
    justify-content: center;
    border-style: solid;
    font-size: 0.7rem;
}

.rg-perks {
    display: grid;
    gap: 8px;
    margin: 0 0 22px;
    padding: 0;
    list-style: none;
}

.rg-perks li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.72);
    font-size: 0.88rem;
    line-height: 1.35;
}

.rg-perks strong { color: #fff; font-weight: 800; }

.rg-perks i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 10px;
    background: rgba(255,193,7,0.12);
    border: 1px solid rgba(255,193,7,0.18);
    color: var(--gold);
    font-size: 0.9rem;
}

/* ---------- Alerte générale ---------- */

.rg-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    margin-bottom: 18px;
    border-radius: 16px;
    background: rgba(255,77,77,0.12);
    border: 1px solid rgba(255,77,77,0.3);
    color: #ffb3b3;
    font-size: 0.9rem;
    font-weight: 600;
}

/* ---------- Progression ---------- */

.rg-progress,
.rg-step-counter { display: none; }

.rg-form.is-js .rg-progress {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 6px;
}

.rg-progress-bar {
    display: block;
    height: 5px;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    overflow: hidden;
    position: relative;
}

.rg-progress-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold), var(--gold-dark));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s ease;
}

.rg-progress-item.is-done .rg-progress-bar::after,
.rg-progress-item.is-current .rg-progress-bar::after { transform: scaleX(1); }

.rg-progress-label {
    display: block;
    margin-top: 6px;
    color: rgba(255,255,255,0.38);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    transition: color 0.25s ease;
}

.rg-progress-item.is-current .rg-progress-label { color: var(--gold); }
.rg-progress-item.is-done .rg-progress-label { color: rgba(255,255,255,0.7); }

.rg-form.is-js .rg-step-counter {
    display: block;
    margin: 0 0 4px;
    color: rgba(255,255,255,0.45);
    font-size: 0.78rem;
    font-weight: 700;
}

/* ---------- Étapes ---------- */

.rg-step {
    margin: 0 0 18px;
    padding: 0;
    border: 0;
    min-width: 0;
}

.rg-form.is-js .rg-step { display: none; }

.rg-form.is-js .rg-step.is-active {
    display: block;
    animation: rgStepIn 0.32s ease both;
}

.rg-form.is-js .rg-step.is-active.is-back { animation-name: rgStepBack; }

@keyframes rgStepIn {
    from { opacity: 0; transform: translateX(18px); }
    to { opacity: 1; transform: none; }
}

@keyframes rgStepBack {
    from { opacity: 0; transform: translateX(-18px); }
    to { opacity: 1; transform: none; }
}

.rg-step-title {
    float: none;
    width: 100%;
    margin: 0 0 16px;
    padding: 0;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: -0.3px;
}

.rg-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 340px) {
    .rg-row { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- Champs à libellé flottant ---------- */

.rg-field {
    position: relative;
    margin-bottom: 14px;
}

.rg-field input {
    width: 100%;
    height: 60px;
    padding: 24px 16px 8px;
    border-radius: 18px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.14);
    color: #fff;
    font-size: 16px; /* 16px minimum : évite le zoom automatique sur iPhone */
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.rg-field input:focus {
    background: rgba(255,255,255,0.1);
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(255,193,7,0.14);
}

.rg-field label {
    position: absolute;
    top: 19px;
    left: 17px;
    color: rgba(255,255,255,0.5);
    font-size: 1rem;
    font-weight: 600;
    pointer-events: none;
    transform-origin: left top;
    transition: transform 0.18s ease, color 0.18s ease;
}

.rg-field input:focus + label,
.rg-field input:not(:placeholder-shown) + label,
.rg-field--static label {
    transform: translateY(-11px) scale(0.76);
    color: rgba(255,255,255,0.62);
}

.rg-field input:focus + label { color: var(--gold); }

/* Auto-remplissage Chrome/Safari : garde le thème sombre au lieu du fond clair */
.rg-field input:-webkit-autofill,
.rg-field input:-webkit-autofill:hover {
    -webkit-text-fill-color: #fff;
    caret-color: #fff;
    box-shadow: 0 0 0 1000px #1f1f21 inset;
    transition: background-color 9999s ease-out 0s;
}

.rg-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff;
    box-shadow: 0 0 0 1000px #242426 inset, 0 0 0 4px rgba(255,193,7,0.14);
}

/* Champs avec icône */
.rg-field--icon input { padding-left: 46px; }
.rg-field--icon label { left: 47px; }

.rg-field-icon {
    position: absolute;
    top: 30px;
    left: 17px;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.4);
    font-size: 1.05rem;
    pointer-events: none;
    transition: color 0.2s ease;
}

.rg-field--icon:focus-within .rg-field-icon { color: var(--gold); }

/* Date */
.rg-field input[type="date"] {
    color-scheme: dark;
    min-height: 60px;
}

.rg-field input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.7;
    cursor: pointer;
}

.rg-field input[type="date"]::-webkit-date-and-time-value { text-align: left; }

/* Mot de passe */
.rg-field--password input { padding-right: 54px; }

.rg-eye {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: rgba(255,255,255,0.55);
    font-size: 1.15rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.rg-form:not(.is-js) .rg-eye { display: none; }
.rg-form:not(.is-js) .rg-field--password input { padding-right: 16px; }

.rg-eye:hover,
.rg-eye:focus-visible {
    background: rgba(255,255,255,0.08);
    color: #fff;
    outline: none;
}

.rg-rules {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    margin: 10px 2px 0;
    padding: 0;
    list-style: none;
}

.rg-rules li {
    display: flex;
    align-items: center;
    gap: 7px;
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    font-weight: 600;
    transition: color 0.2s ease;
}

.rg-rules li::before {
    content: "";
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.25);
    background: center / 10px no-repeat;
    transition: all 0.2s ease;
}

.rg-rules li.is-ok { color: #7dffb0; }

.rg-rules li.is-ok::before {
    border-color: #28c76f;
    background-color: #28c76f;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23111' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
}

/* ---------- Aides et erreurs ---------- */

.rg-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 7px 4px 0;
    color: rgba(255,255,255,0.45);
    font-size: 0.8rem;
    line-height: 1.35;
}

.rg-error {
    display: none;
    margin: 7px 4px 0;
    color: #ff8a8a;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.35;
}

.rg-error:not(:empty) { display: block; }
.rg-error:not(:empty)::before { content: "\F33A"; font-family: "bootstrap-icons"; margin-right: 6px; }

.is-invalid .rg-hint { display: none; }

.rg-field.is-invalid input {
    border-color: rgba(255,90,90,0.75);
    background: rgba(255,77,77,0.07);
}

.rg-field.is-invalid input:focus { box-shadow: 0 0 0 4px rgba(255,90,90,0.14); }
.rg-field.is-invalid label { color: #ff8a8a; }

.rg-field.is-valid input { border-color: rgba(40,199,111,0.55); }

/* ---------- Genre (boutons) ---------- */

.rg-group {
    margin-bottom: 14px;
}

.rg-group-label {
    display: block;
    margin: 0 4px 8px;
    color: rgba(255,255,255,0.62);
    font-size: 0.8rem;
    font-weight: 700;
}

.rg-chips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.rg-chip {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.rg-chip input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    cursor: pointer;
}

.rg-chip span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    border-radius: 16px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.14);
    color: rgba(255,255,255,0.8);
    font-weight: 800;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.rg-chip input:checked + span {
    background: rgba(255,193,7,0.14);
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 0 4px rgba(255,193,7,0.1);
}

.rg-chip input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

.rg-group.is-invalid .rg-chip span { border-color: rgba(255,90,90,0.6); }

/* ---------- Consentement ---------- */

.rg-consent { margin-top: 6px; }

.rg-consent-label {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255,255,255,0.045);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.75);
    font-size: 0.86rem;
    line-height: 1.45;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.rg-consent-label input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.rg-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    margin-top: 1px;
    border-radius: 8px;
    border: 1.5px solid rgba(255,255,255,0.3);
    color: transparent;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.rg-consent-label input:checked + .rg-checkbox {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    border-color: transparent;
    color: #111;
}

.rg-consent-label input:focus-visible + .rg-checkbox { outline: 2px solid var(--gold); outline-offset: 2px; }

.rg-consent-label:has(input:checked) {
    border-color: rgba(255,193,7,0.3);
    background: rgba(255,193,7,0.06);
}

.rg-consent-label a {
    color: var(--gold);
    font-weight: 800;
    text-decoration: none;
}

.rg-consent-label a:hover { text-decoration: underline; }

.rg-consent.is-invalid .rg-consent-label { border-color: rgba(255,90,90,0.6); }

/* ---------- Boutons ---------- */

.rg-actions {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.rg-actions .btn-havana {
    flex: 1;
    min-height: 60px;
    font-size: 1.02rem;
}

.rg-back,
.rg-next { display: none !important; }

.rg-form.is-js .rg-next { display: flex !important; }
.rg-form.is-js .rg-submit { display: none; }
.rg-form.is-js.is-last .rg-next { display: none !important; }
.rg-form.is-js.is-last .rg-submit { display: flex; }

.rg-form.is-js:not(.is-first) .rg-back {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 60px;
    flex: 0 0 60px;
    border-radius: 20px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    color: #fff;
    font-size: 1.2rem;
    transition: background 0.2s ease;
}

.rg-back:hover { background: rgba(255,255,255,0.13); }

.rg-submit-loading { display: none; align-items: center; gap: 10px; }
.rg-submit.is-loading { pointer-events: none; opacity: 0.85; }
.rg-submit.is-loading .rg-submit-text { display: none; }
.rg-submit.is-loading .rg-submit-loading { display: inline-flex; }

.rg-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2.5px solid rgba(17,17,17,0.25);
    border-top-color: #111;
    animation: rgSpin 0.7s linear infinite;
}

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

.rg-login-link {
    margin: 20px 0 0;
    text-align: center;
    color: rgba(255,255,255,0.55);
    font-size: 0.92rem;
}

.rg-login-link a {
    color: var(--gold);
    font-weight: 900;
    text-decoration: none;
    margin-left: 4px;
}

@media (prefers-reduced-motion: reduce) {
    .rg-form.is-js .rg-step.is-active { animation: none; }
    .rg-progress-bar::after,
    .rg-field label { transition: none; }
}

/* Compte déjà existant : raccourcis vers la connexion (visibles malgré l'erreur) */
.is-invalid .rg-hint.rg-account-exists {
    display: block;
    margin-top: 6px;
}

.rg-account-exists a {
    color: #ffc107;
    font-weight: 800;
    text-decoration: none;
}
