/* =========================================================
   HomeDen Registration Modal
   Scoped exclusively to .hd-reg-modal
   ========================================================= */


/* =========================================================
   BODY LOCK
   ========================================================= */

body.hd-register-modal-open {
    overflow: hidden;
}


/* =========================================================
   MODAL ROOT
   ========================================================= */

.hd-reg-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    visibility: hidden;
    opacity: 0;

    pointer-events: none;

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease;
}

.hd-reg-modal.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}


/* =========================================================
   BACKDROP
   ========================================================= */

.hd-reg-modal__backdrop {
    position: absolute;
    inset: 0;

    background: rgba(0, 0, 0, 0.52);

    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);

    cursor: pointer;
}


/* =========================================================
   DIALOG
   ========================================================= */

.hd-reg-modal__dialog {
    position: relative;
    z-index: 2;

    width: min(680px, 100%);
    max-height: calc(100vh - 48px);

    overflow-y: auto;

    background: var(--color-page-bg, #ffffff);

    border: 1px solid var(--color-border);

    border-radius: 24px;

    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.16);

    transform: translateY(18px) scale(0.98);

    transition:
        transform 0.28s ease;
}

.hd-reg-modal.is-open .hd-reg-modal__dialog {
    transform: translateY(0) scale(1);
}


/* =========================================================
   CLOSE BUTTON
   ========================================================= */

.hd-reg-modal__close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 5;

    width: 40px;
    height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    background: var(--color-page-bg, #ffffff);

    border: 1px solid var(--color-border);

    border-radius: 50%;

    color: var(--color-caption);

    font-size: 15px;

    cursor: pointer;

    appearance: none;
    -webkit-appearance: none;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.hd-reg-modal__close:hover {
    background: var(--color-brand);
    border-color: var(--color-brand);
    color: #ffffff;

    transform: rotate(4deg);
}

.hd-reg-modal__close:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 3px;
}


/* =========================================================
   CONTENT
   ========================================================= */

.hd-reg-modal__content {
    padding: 40px;
}


/* =========================================================
   HEADER
   ========================================================= */

.hd-reg-modal__header {
    padding-right: 48px;
    margin-bottom: 24px;
}

.hd-reg-modal__badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    margin-bottom: 14px;

    color: var(--color-brand);

    font-size: 12px;
    font-weight: 700;

    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hd-reg-modal__badge i {
    font-size: 14px;
}

.hd-reg-modal__header h2 {
    margin: 0 0 10px;

    color: var(--color-heading-primary);

    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;

    letter-spacing: -0.025em;
}

.hd-reg-modal__header p {
    max-width: 560px;

    margin: 0;

    color: var(--color-body);

    font-size: 15px;
    font-weight: 400;
    line-height: 1.7;
}


/* =========================================================
   PROGRESS
   ========================================================= */

.hd-reg-modal__progress {
    display: flex;
    align-items: center;
    gap: 8px;

    margin-bottom: 24px;
}

.hd-reg-modal__progress span {
    display: block;

    height: 4px;

    flex: 1;

    background: var(--color-border);

    border-radius: 999px;

    transition: background-color 0.2s ease;
}

.hd-reg-modal__progress span.is-active {
    background: var(--color-brand);
}


/* =========================================================
   ALERT
   ========================================================= */

.hd-reg-modal__alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;

    margin-bottom: 20px;
    padding: 13px 15px;

    border: 1px solid var(--color-border);

    border-radius: 12px;

    font-size: 14px;
    line-height: 1.55;
}

.hd-reg-modal__alert--error {
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.hd-reg-modal__alert > i {
    flex: 0 0 auto;

    margin-top: 2px;

    font-size: 17px;
}

.hd-reg-modal__alert-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}


/* =========================================================
   FORM
   ========================================================= */

.hd-reg-modal__form {
    width: 100%;
    margin: 0;
}


/* =========================================================
   FIELD GRID
   ========================================================= */

.hd-reg-modal__fields {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 20px;
}

.hd-reg-modal__field {
    min-width: 0;
}

.hd-reg-modal__field--wide {
    grid-column: 1 / -1;
}


/* =========================================================
   LABEL
   ========================================================= */

.hd-reg-modal__label {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: 8px;

    color: var(--color-heading-primary);

    font-size: 13px;
    font-weight: 600;
}

.hd-reg-modal__label small {
    color: var(--color-caption);

    font-size: 11px;
    font-weight: 500;
}


/* =========================================================
   INPUT CONTROL
   ========================================================= */

.hd-reg-modal__control {
    position: relative;

    display: flex;
    align-items: center;

    min-height: 50px;

    background: var(--color-page-bg, #ffffff);

    border: 1px solid var(--color-border);

    border-radius: 12px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.hd-reg-modal__control > i {
    position: absolute;
    left: 16px;

    color: var(--color-caption);

    font-size: 16px;

    pointer-events: none;

    transition: color 0.2s ease;
}

.hd-reg-modal__control input {
    width: 100%;
    min-width: 0;

    height: 48px;

    padding: 0 16px 0 44px;

    background: transparent;

    border: 0;
    outline: 0;

    color: var(--color-heading-primary);

    font-family: inherit;

    font-size: 14px;
    font-weight: 400;
}

.hd-reg-modal__control input::placeholder {
    color: var(--color-caption);
    opacity: 0.75;
}

.hd-reg-modal__control:focus-within {
    border-color: var(--color-brand);

    box-shadow:
        0 0 0 3px
        color-mix(
            in srgb,
            var(--color-brand) 12%,
            transparent
        );
}

.hd-reg-modal__control:focus-within > i {
    color: var(--color-brand);
}


/* =========================================================
   MOBILE PREFIX
   ========================================================= */

.hd-reg-modal__control--mobile {
    padding-left: 0;
}

.hd-reg-modal__prefix {
    display: inline-flex;
    align-items: center;

    height: 48px;

    padding: 0 12px 0 14px;

    color: var(--color-heading-primary);

    font-size: 14px;
    font-weight: 600;

    border-right: 1px solid var(--color-border);
}

.hd-reg-modal__control--mobile input {
    padding-left: 12px;
}


/* =========================================================
   VALIDATION ERRORS
   ========================================================= */

.hd-reg-modal__errors {
    display: flex;
    flex-direction: column;
    gap: 3px;

    margin-top: 7px;

    color: var(--color-danger);

    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}


/* =========================================================
   TERMS / CONSENT
   ========================================================= */

.hd-reg-modal__consent {
    margin-top: 22px;
}

.hd-reg-modal__checkbox {
    display: flex;
    align-items: flex-start;

    gap: 10px;

    margin: 0;

    cursor: pointer;
}

.hd-reg-modal__checkbox input {
    position: absolute;

    width: 1px;
    height: 1px;

    opacity: 0;

    pointer-events: none;
}

.hd-reg-modal__checkbox-mark {
    position: relative;

    flex: 0 0 19px;

    width: 19px;
    height: 19px;

    margin-top: 1px;

    background: var(--color-page-bg, #ffffff);

    border: 1px solid var(--color-border);

    border-radius: 5px;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.hd-reg-modal__checkbox input:checked
+ .hd-reg-modal__checkbox-mark {
    background: var(--color-brand);
    border-color: var(--color-brand);
}

.hd-reg-modal__checkbox input:checked
+ .hd-reg-modal__checkbox-mark::after {
    content: "";

    position: absolute;

    left: 6px;
    top: 3px;

    width: 5px;
    height: 9px;

    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;

    transform: rotate(45deg);
}

.hd-reg-modal__checkbox input:focus-visible
+ .hd-reg-modal__checkbox-mark {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

.hd-reg-modal__consent-text {
    color: var(--color-body);

    font-size: 13px;
    line-height: 1.6;
}

.hd-reg-modal__consent-text a {
    color: var(--color-brand);

    font-weight: 600;

    text-decoration: none;
}

.hd-reg-modal__consent-text a:hover {
    text-decoration: underline;
}


/* =========================================================
   SUBMIT BUTTON
   ========================================================= */

.hd-reg-modal__submit {
    width: 100%;
    min-height: 52px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    margin-top: 24px;
    padding: 0 20px;

    background: var(--color-brand);

    border: 1px solid var(--color-brand);
    border-radius: 12px;

    color: #ffffff;

    font-family: inherit;
    font-size: 14px;
    font-weight: 700;

    cursor: pointer;

    appearance: none;
    -webkit-appearance: none;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.hd-reg-modal__submit:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);

    transform: translateY(-1px);

    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.08);
}

.hd-reg-modal__submit:active {
    transform: translateY(0);
}

.hd-reg-modal__submit:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 3px;
}

.hd-reg-modal__submit i {
    font-size: 16px;

    transition:
        transform 0.2s ease;
}

.hd-reg-modal__submit:hover i {
    transform: translateX(3px);
}


/* =========================================================
   LOGIN ROW
   ========================================================= */

.hd-reg-modal__login {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;

    gap: 5px;

    margin-top: 22px;

    color: var(--color-caption);

    font-size: 13px;
    line-height: 1.6;

    text-align: center;
}

.hd-reg-modal__login a {
    color: var(--color-brand);

    font-weight: 700;

    text-decoration: none;
}

.hd-reg-modal__login a:hover {
    text-decoration: underline;
}


/* =========================================================
   PRIVACY NOTE
   ========================================================= */

.hd-reg-modal__privacy {
    display: flex;
    align-items: flex-start;
    justify-content: center;

    gap: 7px;

    max-width: 520px;

    margin: 18px auto 0;

    color: var(--color-caption);

    font-size: 11px;
    line-height: 1.6;

    text-align: center;
}

.hd-reg-modal__privacy i {
    flex: 0 0 auto;

    margin-top: 2px;

    font-size: 13px;
}


/* =========================================================
   RESPONSIVE — TABLET
   ========================================================= */

@media (max-width: 700px) {

    .hd-reg-modal {
        padding: 16px;
    }

    .hd-reg-modal__dialog {
        max-height: calc(100vh - 32px);

        border-radius: 20px;
    }

    .hd-reg-modal__content {
        padding: 32px 24px;
    }

    .hd-reg-modal__header h2 {
        font-size: 26px;
    }

    .hd-reg-modal__fields {
        grid-template-columns: 1fr;
        gap: 17px;
    }

    .hd-reg-modal__field--wide {
        grid-column: auto;
    }

}


/* =========================================================
   RESPONSIVE — MOBILE
   ========================================================= */

@media (max-width: 480px) {

    .hd-reg-modal {
        align-items: flex-end;

        padding: 0;
    }

    .hd-reg-modal__dialog {
        width: 100%;
        max-height: 94vh;

        border-radius:
            22px 22px 0 0;

        transform:
            translateY(30px);
    }

    .hd-reg-modal.is-open
    .hd-reg-modal__dialog {
        transform:
            translateY(0);
    }

    .hd-reg-modal__content {
        padding: 28px 20px 24px;
    }

    .hd-reg-modal__close {
        top: 14px;
        right: 14px;

        width: 36px;
        height: 36px;
    }

    .hd-reg-modal__header {
        padding-right: 42px;
    }

    .hd-reg-modal__badge {
        font-size: 10px;
    }

    .hd-reg-modal__header h2 {
        font-size: 23px;
        line-height: 1.25;
    }

    .hd-reg-modal__header p {
        font-size: 13px;
        line-height: 1.6;
    }

    .hd-reg-modal__label {
        font-size: 12px;
    }

    .hd-reg-modal__control {
        min-height: 48px;
    }

    .hd-reg-modal__control input {
        height: 46px;

        font-size: 14px;
    }

    .hd-reg-modal__prefix {
        height: 46px;

        font-size: 13px;
    }

    .hd-reg-modal__submit {
        min-height: 50px;

        font-size: 13px;
    }

    .hd-reg-modal__login {
        flex-direction: column;
        gap: 2px;

        font-size: 12px;
    }

    .hd-reg-modal__privacy {
        font-size: 10px;
    }

}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .hd-reg-modal,
    .hd-reg-modal__dialog,
    .hd-reg-modal__close,
    .hd-reg-modal__control,
    .hd-reg-modal__submit,
    .hd-reg-modal__progress span {
        transition: none;
    }

}