/* =========================================================
   ESChE DIGITAL MEMBERSHIP
   Registration Form — UI/UX Enhancement
   Version: 1.0.0

   Scope:
   - Visual styling only
   - No changes to registration logic
   - Preserve the existing six-step registration wizard
   ========================================================= */


/* ---------------------------------------------------------
   1. DESIGN TOKENS
   --------------------------------------------------------- */

body .esche-member-registration {
    --esche-primary: #174ea6;
    --esche-primary-dark: #103b80;
    --esche-primary-light: #edf4ff;

    --esche-text: #172b4d;
    --esche-text-secondary: #5f6f85;

    --esche-border: #dce4ee;
    --esche-border-focus: #7ba7f7;

    --esche-background: #ffffff;
    --esche-surface: #f7f9fc;

    --esche-success: #18864b;
    --esche-success-light: #eaf7ef;

    --esche-danger: #c62828;
    --esche-danger-light: #fff0f0;

    --esche-radius: 12px;
    --esche-radius-small: 8px;

    --esche-shadow:
        0 12px 36px rgba(23, 43, 77, 0.07);

    color: var(--esche-text);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.65;

    width: 100%;
    max-width: 960px;
    margin: 36px auto;
    padding: 0 20px;

    box-sizing: border-box;
}

body .esche-member-registration *,
body .esche-member-registration *::before,
body .esche-member-registration *::after {
    box-sizing: border-box;
}


/* ---------------------------------------------------------
   2. TYPOGRAPHY
   --------------------------------------------------------- */

body .esche-member-registration h1,
body .esche-member-registration h2,
body .esche-member-registration h3,
body .esche-member-registration h4 {
    color: var(--esche-text);
    font-family: inherit;
    line-height: 1.35;
}

body .esche-member-registration .esche-registration-section h2 {
    margin: 0 0 12px;
    font-size: clamp(22px, 3vw, 29px);
    font-weight: 750;
    letter-spacing: -0.5px;
}

body .esche-member-registration .esche-membership-fields h3 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 700;
}

body .esche-member-registration p {
    color: var(--esche-text-secondary);
}

body .esche-member-registration small {
    display: block;
    margin-top: 7px;
    color: var(--esche-text-secondary);
    font-size: 12px;
    line-height: 1.6;
}


/* ---------------------------------------------------------
   3. FORM CONTAINER
   --------------------------------------------------------- */

body .esche-member-registration .esche-registration-form {
    width: 100%;
    padding: clamp(20px, 4vw, 40px);
    background: var(--esche-background);
    border: 1px solid var(--esche-border);
    border-radius: 18px;
    box-shadow: var(--esche-shadow);
}


/* ---------------------------------------------------------
   4. PROGRESS INDICATOR
   --------------------------------------------------------- */

body .esche-member-registration .esche-registration-progress {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;

    margin: 0 0 36px;
    padding: 0 0 24px;

    border-bottom: 1px solid var(--esche-border);
}

body .esche-member-registration .esche-progress-step {
    position: relative;
    min-width: 0;

    color: var(--esche-text-secondary);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;

    transition: color 0.2s ease;
}

body .esche-member-registration .esche-progress-step span {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;
    margin: 0 auto 10px;

    border: 2px solid var(--esche-border);
    border-radius: 50%;

    background: var(--esche-surface);
    color: var(--esche-text-secondary);

    font-size: 14px;
    font-weight: 700;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

body .esche-member-registration .esche-progress-step.active {
    color: var(--esche-primary);
    font-weight: 700;
}

body .esche-member-registration .esche-progress-step.active span {
    border-color: var(--esche-primary);
    background: var(--esche-primary);
    color: #fff;

    box-shadow: 0 0 0 5px var(--esche-primary-light);
}

body .esche-member-registration .esche-progress-step.completed {
    color: var(--esche-success);
}

body .esche-member-registration .esche-progress-step.completed span {
    border-color: var(--esche-success);
    background: var(--esche-success);
    color: #fff;
}


/* ---------------------------------------------------------
   5. REGISTRATION STEPS
   --------------------------------------------------------- */

body .esche-member-registration .esche-registration-section {
    display: none;
    animation: escheRegistrationFadeIn 0.25s ease;
}

body .esche-member-registration .esche-registration-section.active {
    display: block;
}

@keyframes escheRegistrationFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ---------------------------------------------------------
   6. MEMBERSHIP-SPECIFIC GROUPS
   --------------------------------------------------------- */

body .esche-member-registration .esche-membership-fields {
    margin: 22px 0;
    padding: 25px;

    border: 1px solid var(--esche-border);
    border-radius: var(--esche-radius);

    background: var(--esche-surface);
}

body .esche-member-registration .esche-membership-fields[hidden],
body .esche-member-registration [data-personal-name-fields][hidden],
body .esche-member-registration [data-photo-for][hidden] {
    display: none !important;
}


/* ---------------------------------------------------------
   7. FORM GRID
   --------------------------------------------------------- */

body .esche-member-registration .esche-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 22px;
    row-gap: 4px;
}

body .esche-member-registration .esche-form-field {
    min-width: 0;
    margin-bottom: 22px;
}

body .esche-member-registration .esche-form-field label {
    display: block;
    margin-bottom: 8px;

    color: var(--esche-text);
    font-size: 14px;
    font-weight: 650;
    line-height: 1.5;
}

body .esche-member-registration .esche-form-field label > span,
body .esche-member-registration .esche-photo-field label > span {
    color: var(--esche-danger);
}


/* ---------------------------------------------------------
   8. INPUTS AND SELECTS
   --------------------------------------------------------- */

body .esche-member-registration .esche-form-field input[type="text"],
body .esche-member-registration .esche-form-field input[type="email"],
body .esche-member-registration .esche-form-field input[type="password"],
body .esche-member-registration .esche-form-field input[type="tel"],
body .esche-member-registration .esche-form-field input[type="url"],
body .esche-member-registration .esche-form-field input[type="number"],
body .esche-member-registration .esche-form-field input[type="file"],
body .esche-member-registration .esche-form-field select,
body .esche-member-registration .esche-form-field textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 12px 14px;

    border: 1px solid var(--esche-border);
    border-radius: var(--esche-radius-small);

    background: #fff;
    color: var(--esche-text);

    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;

    box-shadow: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

body .esche-member-registration .esche-form-field textarea {
    min-height: 120px;
    resize: vertical;
}

body .esche-member-registration .esche-form-field input::placeholder,
body .esche-member-registration .esche-form-field textarea::placeholder {
    color: #8b98a9;
    opacity: 1;
}

body .esche-member-registration .esche-form-field input:focus,
body .esche-member-registration .esche-form-field select:focus,
body .esche-member-registration .esche-form-field textarea:focus {
    outline: none;

    border-color: var(--esche-border-focus);
    box-shadow: 0 0 0 3px rgba(23, 78, 166, 0.12);
}

body .esche-member-registration .esche-form-field input:disabled,
body .esche-member-registration .esche-form-field select:disabled,
body .esche-member-registration .esche-form-field textarea:disabled {
    background: #f0f2f5;
    color: #8993a2;
    cursor: not-allowed;
}

body .esche-member-registration .esche-form-field input[type="file"] {
    padding: 9px;
    background: #fff;
    cursor: pointer;
}

body .esche-member-registration .esche-form-field input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 7px 12px;

    border: 1px solid var(--esche-border);
    border-radius: 6px;

    background: var(--esche-primary-light);
    color: var(--esche-primary);

    font-family: inherit;
    font-size: 12px;
    font-weight: 650;

    cursor: pointer;
}


/* ---------------------------------------------------------
   9. PASSWORD REQUIREMENTS
   --------------------------------------------------------- */

body .esche-member-registration .esche-password-requirements {
    display: grid;
    gap: 8px;

    margin: 12px 0 0;
    padding: 14px 16px;

    border: 1px solid var(--esche-border);
    border-radius: var(--esche-radius-small);

    background: var(--esche-surface);
    list-style: none;
}

body .esche-member-registration .esche-password-requirements li {
    display: flex;
    align-items: flex-start;
    gap: 8px;

    color: var(--esche-text-secondary);
    font-size: 12px;
    line-height: 1.6;
}

body .esche-member-registration .esche-password-requirements li span {
    flex: 0 0 18px;
    width: 18px;

    color: #9aa5b4;
    font-weight: 700;
}

body .esche-member-registration .esche-password-requirements li.is-valid {
    color: var(--esche-success);
}

body .esche-member-registration .esche-password-requirements li.is-valid span {
    color: var(--esche-success);
}


/* ---------------------------------------------------------
   10. IMAGE UPLOAD NOTICES
   --------------------------------------------------------- */

body .esche-member-registration .esche-institution-logo-notice {
    padding: 12px 14px;

    border-left: 3px solid var(--esche-primary);
    border-radius: 0 var(--esche-radius-small) var(--esche-radius-small) 0;

    background: var(--esche-primary-light);
    color: var(--esche-primary) !important;

    font-size: 13px;
    line-height: 1.6;
}


/* ---------------------------------------------------------
   11. NAVIGATION BUTTONS
   --------------------------------------------------------- */

body .esche-member-registration .esche-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;

    margin-top: 32px;
    padding-top: 22px;

    border-top: 1px solid var(--esche-border);
}

body .esche-member-registration .esche-form-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 48px;
    padding: 12px 24px;

    border: 1px solid transparent;
    border-radius: var(--esche-radius-small);

    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

body .esche-member-registration .esche-registration-next,
body .esche-member-registration .esche-registration-submit {
    background: var(--esche-primary);
    color: #fff;
}

body .esche-member-registration .esche-registration-next:hover,
body .esche-member-registration .esche-registration-submit:hover {
    background: var(--esche-primary-dark);
    color: #fff;
}

body .esche-member-registration .esche-registration-back {
    border-color: var(--esche-border);
    background: #fff;
    color: var(--esche-text);
}

body .esche-member-registration .esche-registration-back:hover {
    border-color: #b8c8dc;
    background: var(--esche-surface);
}

body .esche-member-registration .esche-form-actions button:focus-visible {
    outline: 3px solid rgba(23, 78, 166, 0.3);
    outline-offset: 3px;
}

body .esche-member-registration .esche-form-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* ---------------------------------------------------------
   12. ERROR MESSAGES
   --------------------------------------------------------- */

body .esche-member-registration .esche-registration-errors {
    margin: 0 0 24px;
    padding: 16px 18px;

    border: 1px solid #f0c4c4;
    border-left: 4px solid var(--esche-danger);
    border-radius: var(--esche-radius-small);

    background: var(--esche-danger-light);
    color: #8d2020;
}

body .esche-member-registration .esche-registration-errors p,
body .esche-member-registration .esche-registration-errors li {
    color: #8d2020;
}


/* ---------------------------------------------------------
   13. REVIEW SUMMARY
   --------------------------------------------------------- */

body .esche-member-registration .esche-registration-review {
    margin: 20px 0;
    padding: 24px;

    border: 1px solid var(--esche-border);
    border-radius: var(--esche-radius);

    background: var(--esche-surface);
}

body .esche-member-registration .esche-review-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;

    padding: 13px 0;

    border-bottom: 1px solid var(--esche-border);
}

body .esche-member-registration .esche-review-row:last-child {
    border-bottom: 0;
}

body .esche-member-registration .esche-review-label {
    flex: 0 0 42%;
    color: var(--esche-text);
    font-size: 13px;
    font-weight: 700;
}

body .esche-member-registration .esche-review-row > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;

    color: var(--esche-text-secondary);
    font-size: 13px;
    text-align: right;
}


/* ---------------------------------------------------------
   14. IMAGE PREVIEW
   --------------------------------------------------------- */

body .esche-member-registration .esche-review-image-row {
    margin: 0 0 24px;
    padding: 22px;

    border: 1px solid var(--esche-border);
    border-radius: var(--esche-radius);

    background: #fff;
}

body .esche-member-registration #esche-review-image-title {
    display: block;
    margin-bottom: 14px;

    color: var(--esche-text);
    font-size: 15px;
    font-weight: 700;
}

body .esche-member-registration .esche-review-image-container {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
}

body .esche-member-registration #esche-review-image-preview {
    display: block;

    width: 120px;
    height: 145px;

    object-fit: cover;
    object-position: center;

    border: 1px solid var(--esche-border);
    border-radius: var(--esche-radius-small);

    background: var(--esche-surface);
}

body .esche-member-registration #esche-review-image-preview.esche-institution-logo-preview {
    width: 180px;
    height: 180px;

    padding: 10px;

    object-fit: contain;

    border-radius: var(--esche-radius-small);
    background: #fff;
}

body .esche-member-registration #esche-review-image-preview[hidden] {
    display: none !important;
}

body .esche-member-registration #esche-review-image-placeholder {
    margin: 0;
    color: var(--esche-text-secondary);
    font-size: 13px;
}


/* ---------------------------------------------------------
   15. TERMS AND CONDITIONS
   --------------------------------------------------------- */

body .esche-member-registration .esche-consent {
    margin-top: 22px;
    padding: 16px;

    border: 1px solid var(--esche-border);
    border-radius: var(--esche-radius-small);

    background: var(--esche-surface);
}

body .esche-member-registration .esche-consent-label {
    display: flex !important;
    align-items: flex-start;
    gap: 11px;

    cursor: pointer;

    color: var(--esche-text);
    font-size: 13px;
    font-weight: 400 !important;
    line-height: 1.65;
}

body .esche-member-registration .esche-consent-label input[type="checkbox"] {
    appearance: auto;
    -webkit-appearance: auto;

    flex: 0 0 18px;

    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;

    margin: 3px 0 0 !important;
    padding: 0 !important;

    accent-color: var(--esche-primary);
    cursor: pointer;
}

body .esche-member-registration .esche-consent-text {
    color: var(--esche-text-secondary) !important;
    font-weight: 400 !important;
}

body .esche-member-registration .esche-consent-text a {
    color: var(--esche-primary);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

body .esche-member-registration .esche-consent-text a:hover {
    color: var(--esche-primary-dark);
}


/* ---------------------------------------------------------
   16. ACCESSIBILITY
   --------------------------------------------------------- */

body .esche-member-registration a:focus-visible,
body .esche-member-registration input:focus-visible,
body .esche-member-registration select:focus-visible,
body .esche-member-registration textarea:focus-visible {
    outline-color: var(--esche-border-focus);
    outline-offset: 2px;
}


/* ---------------------------------------------------------
   17. TABLET RESPONSIVENESS
   --------------------------------------------------------- */

@media (max-width: 700px) {

    body .esche-member-registration {
        margin: 20px auto;
        padding: 0 14px;
    }

    body .esche-member-registration .esche-registration-form {
        padding: 22px 18px;
        border-radius: 14px;
    }

    body .esche-member-registration .esche-registration-progress {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        row-gap: 22px;
        margin-bottom: 28px;
        padding-bottom: 22px;
    }

    body .esche-member-registration .esche-progress-step {
        font-size: 11px;
    }

    body .esche-member-registration .esche-progress-step span {
        width: 34px;
        height: 34px;
        margin-bottom: 7px;
        font-size: 12px;
    }

    body .esche-member-registration .esche-form-grid {
        grid-template-columns: minmax(0, 1fr);
        column-gap: 0;
    }

    body .esche-member-registration .esche-membership-fields {
        padding: 18px;
    }

    body .esche-member-registration .esche-review-row {
        flex-direction: column;
        gap: 4px;
    }

    body .esche-member-registration .esche-review-label {
        flex-basis: auto;
    }

    body .esche-member-registration .esche-review-row > span:last-child {
        text-align: left;
    }
}


/* ---------------------------------------------------------
   18. SMALL MOBILE SCREENS
   --------------------------------------------------------- */

@media (max-width: 420px) {

    body .esche-member-registration {
        padding: 0 10px;
    }

    body .esche-member-registration .esche-registration-form {
        padding: 18px 14px;
    }

    body .esche-member-registration .esche-form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    body .esche-member-registration .esche-form-actions button {
        width: 100%;
    }

    body .esche-member-registration .esche-membership-fields {
        padding: 15px;
    }

    body .esche-member-registration .esche-registration-review {
        padding: 17px;
    }

    body .esche-member-registration .esche-review-image-row {
        padding: 17px;
    }
}


/* ---------------------------------------------------------
   19. REDUCED MOTION
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

    body .esche-member-registration *,
    body .esche-member-registration *::before,
    body .esche-member-registration *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Password checklist: unmet requirements */
body .esche-member-registration
.esche-password-requirements li.is-invalid {
    color: #dc2626;
}

body .esche-member-registration
.esche-password-requirements li.is-invalid span {
    color: #dc2626;
    font-weight: 700;
}

/* Password checklist: satisfied requirements */
body .esche-member-registration
.esche-password-requirements li.is-valid {
    color: #15803d;
}

body .esche-member-registration
.esche-password-requirements li.is-valid span {
    color: #15803d;
    font-weight: 700;
}

/* Password confirmation mismatch message */
body .esche-member-registration .esche-password-match-error {
    display: block;
    margin-top: 6px;
    color: #dc2626;
    font-size: 0.875rem;
    font-weight: 500;
}

body .esche-member-registration .esche-password-match-error[hidden] {
    display: none;
}

/* Fix double checkmark on Terms & Conditions checkbox */
body .esche-member-registration
.esche-consent-label input[type="checkbox"] {
    appearance: auto !important;
    -webkit-appearance: checkbox !important;

    background-image: none !important;
    box-shadow: none !important;
}

/* Prevent theme-generated checkmarks from appearing twice */
body .esche-member-registration
.esche-consent-label input[type="checkbox"]::before,
body .esche-member-registration
.esche-consent-label input[type="checkbox"]::after {
    content: none !important;
    display: none !important;
}