/* =========================================================================
   Register page (modernized)

   Shares the visual chrome of the login page (slate gradient backdrop,
   white card, 1League logo + SPORTS HUB tagline, primary blue accent)
   so the two auth screens feel like siblings. Self-contained: depends
   only on its own --register-* tokens and the Roboto font.

   Layout:
     - body.register : full-viewport gradient
     - .register-shell : centered flex container
     - .register-card  : white rounded card holding everything
     - .register-grid  : 2-column responsive form grid
                         (first/last + password pair occupy 1 col each;
                          username, email, confirm-email span both)
     - .register-error : surfaces server-side registration_failed banner
   ========================================================================= */

:root {
    --register-bg-start:      #0f172a;
    --register-bg-end:        #1e293b;
    --register-card-bg:       #ffffff;
    --register-text:          #2c3e50;
    --register-text-muted:    #7f8c8d;
    --register-text-soft:     #cbd5e1;
    --register-border:        #dee2e6;
    --register-border-strong: #c2c8cf;
    --register-accent:        #3498db;
    --register-accent-strong: #2980b9;
    --register-error-bg:      #fef2f2;
    --register-error-border:  #fecaca;
    --register-error-fg:      #b91c1c;
    --register-success-bg:    #ecfdf5;
    --register-success-border:#a7f3d0;
    --register-success-fg:    #047857;
    --register-shadow-lg:     0 24px 60px rgba(0, 0, 0, 0.40);
    --register-radius-lg:     22px;
    --register-radius-md:     12px;

    --register-fs-xs:   clamp(16.64px, 1.536vw + 10.24px,  19.2px);
    --register-fs-sm:   clamp(17.92px, 1.792vw + 11.52px,  23.04px);
    --register-fs-base: clamp(20.48px, 2.048vw + 12.8px, 25.6px);
    --register-fs-md:   clamp(23.04px, 2.56vw + 14.08px, 30.72px);
    --register-fs-lg:   clamp(33.28px, 3.84vw + 17.92px, 48.64px);
}

html, body.register {
    height: 100%;
    margin: 0;
}

body.register {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    color: var(--register-text);
    background: linear-gradient(180deg, var(--register-bg-start) 0%, var(--register-bg-end) 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.register-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    box-sizing: border-box;
}

.register-card {
    width: 92vw;
    max-width: none;
    background: var(--register-card-bg);
    border-radius: var(--register-radius-lg);
    box-shadow: var(--register-shadow-lg);
    padding: 40px 38px;
    box-sizing: border-box;
}

/* =========================================================================
   Brand block at the top: logo + SPORTS HUB tagline.
   Tagline uses per-character flex to match the wordmark width above.
   ========================================================================= */
.register-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 22px;
}

.register-brand__logo {
    display: block;
    height: 88px;
    width: auto;
}

.register-brand__tagline {
    display: flex;
    justify-content: space-between;
    width: 122px;
    margin-top: 12px;
    font-family: 'Roboto', sans-serif;
    font-size: 12.8pt;
    font-weight: 500;
    color: var(--register-text-muted);
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
}

.register-brand__tagline > span {
    flex: 0 0 auto;
}

/* =========================================================================
   Title / subtitle
   ========================================================================= */
.register-card__title {
    margin: 0;
    text-align: center;
    font-size: var(--register-fs-lg);
    font-weight: 700;
    color: var(--register-text);
    letter-spacing: -0.01em;
}

.register-card__subtitle {
    margin: 6px 0 24px 0;
    text-align: center;
    font-size: var(--register-fs-sm);
    color: var(--register-text-muted);
    font-weight: 400;
}

/* =========================================================================
   Server-side error banner (registration_failed). Renders Django form
   errors which can include nested <ul><li> markup, so we style those too.
   ========================================================================= */
.register-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px 14px;
    background: var(--register-error-bg);
    border: 1px solid var(--register-error-border);
    border-radius: var(--register-radius-md);
    color: var(--register-error-fg);
    font-size: var(--register-fs-sm);
    font-weight: 500;
    line-height: 1.4;
}

.register-error svg {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-top: 2px;
}

.register-error ul {
    margin: 4px 0 0 0;
    padding-left: 20px;
}

.register-error li {
    margin: 2px 0;
}

/* =========================================================================
   Form layout
   ========================================================================= */
.register-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* 2-column grid; spans break to 1 column on mobile. */
.register-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}

.register-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.register-field--full {
    grid-column: 1 / -1;
}

.register-field__label {
    font-size: var(--register-fs-xs);
    font-weight: 600;
    color: var(--register-text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Style the inputs Django renders inside .register-field so we don't have to
   override widgets in forms.py. Targets text/email/tel/password and the bare
   input that UserCreationForm emits. */
.register-field input[type="text"],
.register-field input[type="email"],
.register-field input[type="tel"],
.register-field input[type="password"],
.register-field input:not([type]) {
    width: 100%;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
    font-size: var(--register-fs-base);
    padding: 13px 15px;
    border: 1px solid var(--register-border-strong);
    border-radius: var(--register-radius-md);
    background: #fff;
    color: var(--register-text);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.register-field input[type="text"]:focus,
.register-field input[type="email"]:focus,
.register-field input[type="tel"]:focus,
.register-field input[type="password"]:focus,
.register-field input:not([type]):focus {
    border-color: var(--register-accent);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15);
}

/* Helper text shown beneath an input to explain why the field is needed
   (e.g. the password-reset note under Cell number). */
.register-field__help {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: var(--register-fs-xs);
    color: var(--register-text-muted);
    line-height: 1.35;
}

.register-field__help-icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    color: var(--register-accent);
}

.register-field__optional {
    font-weight: 400;
    color: var(--register-text-muted);
}

/* Per-field error helper text under the input. */
.register-field__error {
    font-size: var(--register-fs-xs);
    color: var(--register-error-fg);
    font-weight: 500;
    line-height: 1.3;
}

.register-field__error ul {
    margin: 0;
    padding-left: 16px;
}

/* =========================================================================
   Submit button
   ========================================================================= */
.register-submit {
    margin-top: 4px;
    padding: 14px 24px;
    background: var(--register-accent);
    color: #fff;
    border: none;
    border-radius: var(--register-radius-md);
    font-family: 'Roboto', sans-serif;
    font-size: var(--register-fs-base);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.25);
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.register-submit:hover {
    background: var(--register-accent-strong);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.32);
}

.register-submit:active {
    transform: translateY(0);
}

.register-submit:focus-visible {
    outline: 3px solid rgba(52, 152, 219, 0.45);
    outline-offset: 2px;
}

/* =========================================================================
   Footer + links
   ========================================================================= */
.register-card__footer {
    margin: 24px 0 0 0;
    text-align: center;
    font-size: var(--register-fs-sm);
    color: var(--register-text-muted);
}

.register-link {
    color: var(--register-accent);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--register-fs-sm);
}

.register-link:hover { text-decoration: underline; }

.register-link--strong { font-weight: 700; }

.register-card__legal {
    margin: 16px 0 0 0;
    text-align: center;
    font-size: var(--register-fs-sm);
    color: var(--register-text-muted);
}

.register-card__legal-sep {
    margin: 0 0.35em;
}

/* =========================================================================
   Success screen variants
   ========================================================================= */
.register-success {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    margin: 0 0 18px 0;
    background: var(--register-success-bg);
    border: 1px solid var(--register-success-border);
    border-radius: var(--register-radius-md);
    color: var(--register-success-fg);
    font-size: var(--register-fs-sm);
    font-weight: 500;
    line-height: 1.4;
}

.register-success svg {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
}

.register-success__hero {
    text-align: center;
    margin-bottom: 18px;
}

.register-success__hero-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    color: var(--register-success-fg);
}

.register-success__name {
    font-size: var(--register-fs-md);
    font-weight: 600;
    color: var(--register-text);
    margin-bottom: 6px;
}

.register-success__hint {
    color: var(--register-text-muted);
    font-size: var(--register-fs-sm);
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 540px) {
    .register-card {
        padding: 32px 22px;
        border-radius: 18px;
    }

    .register-brand__logo {
        height: 72px;
    }

    .register-brand__tagline {
        width: 100px;
        font-size: 11.52pt;
    }

    .register-grid {
        grid-template-columns: 1fr;
    }
}

/* SMS phone verification */
.register-phone-verify__row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.register-field--grow {
    flex: 1 1 auto;
    min-width: 0;
}

.register-phone-verify__send {
    flex: 0 0 auto;
    border: 1px solid var(--register-accent);
    background: #fff;
    color: var(--register-accent);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: var(--register-fs-sm);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.register-phone-verify__send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.register-phone-verify__status {
    margin-top: 8px;
    font-size: var(--register-fs-xs);
    line-height: 1.35;
}

.register-phone-verify__status.phone-verify-status--success {
    color: #1e8449;
}

.register-phone-verify__status.phone-verify-status--error {
    color: var(--register-error-fg);
}

.register-phone-verify__status.phone-verify-status--pending {
    color: var(--register-text-muted);
}

/* SMS opt-in consent */
.sms-opt-in {
    margin-bottom: 12px;
}

.sms-opt-in__label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: 400;
}

.sms-opt-in__checkbox {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--register-accent);
}

.sms-opt-in__text {
    font-size: var(--register-fs-xs);
    line-height: 1.45;
    color: var(--register-text-muted);
}

.sms-opt-in__text a {
    color: var(--register-accent);
    text-decoration: underline;
}

.sms-opt-in__error {
    margin-top: 6px;
    font-size: var(--register-fs-xs);
    color: var(--register-error-fg);
    font-weight: 500;
}
