/* Registration Form - BEM Style */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.sm-register-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}

.sm-register {
    width: 100%;
}

/* Block: Register Container */
.register-container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

.register-container__row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
    justify-content: center;
}

.register-container__column {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

/* Block: Register Form */
.register-form {
    padding: 40px 35px;
    background: white;
    border: 1px solid #e3e6ea !important;
    border-radius: 12px;
    margin-top: 50px;
    margin-bottom: 50px;
    width: 100%;
}

@media (min-width: 768px) {
    .register-form {
        padding: 45px 50px;
    }
}

@media (min-width: 992px) {
    .register-form {
        padding: 30px 25px;
    }
}

.register-form__title {
    text-align: center;
    color: #333;
    margin-bottom: 35px;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

@media (min-width: 768px) {
    .register-form__title {
        font-size: 32px;
        margin-bottom: 40px;
    }
}

.register-form__fieldset {
    border: none;
}

/* Form groups */
.register-form__group {
    margin-bottom: 24px;
    display: block !important;
    border: none !important;
}

@media (min-width: 768px) {
    .register-form__group {
        margin-bottom: 28px;
    }
}

.register-form__group--checkbox {
    margin-bottom: 12px;
}

.register-form__label {
    display: block;
    margin-bottom: 10px;
    color: #495057;
    font-weight: 500;
    font-size: 15px;
    text-align: left;
    position: relative;
    background: transparent !important;
    padding: 0 !important;
}

@media (min-width: 768px) {
    .register-form__label {
        font-size: 15px;
        margin-bottom: 10px;
    }
}

.register-form__input-wrapper {
    width: 100%;
}

.register-form__checkbox-wrapper {
    width: 100%;
}

.register-form__submit-wrapper {
    width: 100%;
}

.register-form__login-wrapper {
    width: 100%;
}

/* Form controls */
.register-form__input {
    display: block;
    width: 100%;
    padding: 10px 12px; /* match profile-form__input */
    font-size: 14px;    /* match profile-form__input */
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 4px; /* match profile-form__input */
    transition: border-color 0.15s ease-in-out;
    height: auto;
    max-width: 100%;
}

@media (min-width: 768px) {
    .register-form__input {
        padding: 10px 12px; /* keep identical across breakpoints */
        font-size: 14px;
    }
}

.register-form__input:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
}

.register-form__input--otp {
    flex: 1;
}

.register-form__input--optional {
    /* Optional input styling if needed */
}

/* Input with button group */
.register-form__input-button-group {
    display: flex;
    gap: 8px;
}

.register-form__input-button-group input {
    flex: 1;
}

/* OTP area */
.register-form__otp-area {
    margin-top: 12px;
    padding: 14px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.register-form__otp-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.register-form__otp-meta {
    font-size: 13px;
    color: #6c757d;
}

.register-form__otp-timer {
    font-weight: 500;
}

.register-form__otp-verified {
    color: #155724;
    text-align: center;
    font-weight: bold;
}

.register-form__otp-expired {
    padding: 10px;
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    text-align: center;
}

/* Buttons */
.register-form__button {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 12px 20px;
    font-size: 15px;
    line-height: 1.5;
    border-radius: 6px;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
}

@media (min-width: 768px) {
    .register-form__button {
        padding: 12px 24px;
    }
}

.register-form__button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.register-form__button--primary {
    color: #fff;
    background-color: #066AAF;
    border-color: #066AAF;
}

.register-form__button--primary:hover:not(:disabled) {
    background-color: #055C92;
    border-color: #055C92;
}

.register-form__button--secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.register-form__button--secondary:hover:not(:disabled) {
    background-color: #5a6268;
    border-color: #545b62;
}

.register-form__button--full {
    display: block;
    width: 100%;
}

.register-form__button--success {
    color: #fff;
    background-color: #28a745;
    border-color: #28a745;
}

/* Password strength */
.register-form__password-strength {
    margin-top: 12px;
    padding: 14px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.register-form__password-strength-text {
    margin-bottom: 10px;
    font-size: 14px;
    color: #6c757d;
}

.register-form__password-strength-result {
    font-weight: 500;
}

.register-form__progress {
    display: flex;
    height: 6px;
    overflow: hidden;
    font-size: 0.75rem;
    background-color: #e9ecef;
    border-radius: 4px;
    margin-bottom: 12px;
}

.register-form__progress-bar {
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    background-color: #066AAF;
    transition: width 0.6s ease;
}

.register-form__progress-bar--success {
    background-color: #28a745;
}

.register-form__progress-bar--warning {
    background-color: #ffc107;
}

.register-form__progress-bar--danger {
    background-color: #dc3545;
}

/* Password checklist */
.register-form__password-checklist {
    padding-left: 0;
    list-style: none;
}

.register-form__password-checklist-item {
    padding: 5px 0;
    font-size: 14px;
    color: #6c757d;
}

.register-form__password-checklist-item--success {
    color: #28a745;
}

.register-form__password-checklist-item--success .register-form__check-icon {
    color: #28a745;
}

.register-form__check-icon {
    display: inline-block;
    width: 16px;
    text-align: center;
    color: #dc3545;
}

.register-form__check-icon--success {
    color: #28a745;
}

/* Error messages */
.register-form__error {
    font-weight: 400;
    font-size: 13px;
    color: #dc3545;
    float: right;
    margin-left: 10px;
    /* Hide by default; JS will unhide by removing --hide */
    display: none;
}

/* Explicit hide state (kept for JS toggling) */
.register-form__error--hide {
    display: none !important;
}

/* Show when not explicitly hidden */
.register-form__error:not(.register-form__error--hide) {
    display: inline;
}

/* Checkboxes */
.register-form__checkbox-label {
    display: flex;
    align-items: center;
    font-size: 15px;
    cursor: pointer;
}

.register-form__checkbox {
    margin-right: 8px;
    cursor: pointer;
}

/* Links */
.register-form__link {
    color: #066AAF;
    text-decoration: underline;
}

.register-form__link:hover {
    color: #055C92;
}

/* Popover */
.register-form__popover {
    margin-top: 12px;
}

.register-form__popover--hide {
    display: none !important;
}

.register-form__popover-text {
    margin: 0;
    font-size: 15px;
    color: #6c757d;
}

/* Success message */
.register-form__success-message {
    margin-top: 12px;             /* match profile */
    padding: 12px;                /* match profile */
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    border-radius: 4px;           /* match profile */
    text-align: center;
    font-weight: 500;             /* match profile */
}

.register-form__success-message--hide {
    display: none !important;
}

/* Divider section */
.register-form__divider {
    position: relative;
    margin: 30px 0 20px;
    text-align: center;
}

.register-form__divider-text {
    background-color: white;
    padding: 0 15px;
    display: inline-block;
    position: relative;
    z-index: 1;
    color: #6c757d;
    font-size: 15px;
}

.register-form__divider-line {
    position: absolute;
    height: 1px;
    background: #dee2e6;
    width: 100%;
    top: 50%;
    left: 0;
    z-index: 0;
}

/* Block: Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal--show {
    display: block;
}

.modal__dialog {
    position: relative;
    width: auto;
    margin: 50px auto;
    max-width: 500px;
}

.modal__content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    outline: 0;
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
}

.modal__title {
    margin: 0;
    line-height: 1.5;
    font-size: 18px;
    font-weight: 500;
}

.modal__body {
    position: relative;
    flex: 1 1 auto;
    padding: 20px;
    max-height: 500px;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
}

.modal__text {
    margin: 0;
    font-size: 14px;
}

/* Modal content: basic typography and table styles */
.modal__text h1 {
    font-size: 22px;
    margin-bottom: 10px;
}
.modal__text h2 {
    font-size: 20px;
    margin-bottom: 8px;
}
.modal__text h3 {
    font-size: 18px;
    margin-bottom: 6px;
}
.modal__text h4 {
    font-size: 16px;
    margin-bottom: 6px;
}
.modal__text p {
    display: block; /* ensure paragraph renders as block in all themes */
    margin: 0 0 12px;
    line-height: 1.6;
}

.modal__text ol, .modal__text ul {
    display: block; /* ensure paragraph renders as block in all themes */
    margin-top: 4px;
    margin-bottom: 12px;
    padding-left: 20px;
}

.modal__text table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 10px 0 16px;
}

.modal__text th,
.modal__text td {
    border: 1px solid #dee2e6;
    padding: 8px 10px;
    vertical-align: top;
}

.modal__text thead th {
    background: #f8f9fa;
    font-weight: 600;
    text-align: left;
}

.modal__footer {
    display: none !important;
    align-items: center;
    justify-content: flex-end;
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
}

.modal__close {
    padding: 0;
    background: transparent;
    border: 0;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    opacity: 0.5;
    cursor: pointer;
}

.modal__close:hover {
    opacity: 0.75;
}

.modal__button {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 4px;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
}

.modal__button--close {
    color: #333;
    background-color: #fff;
    border-color: #ccc;
}

.modal__button--close:hover {
    background-color: #e6e6e6;
    border-color: #adadad;
}

/* Prevent background scroll when any modal is open */
body.modal-open {
    overflow: hidden !important;
}

/* Utility classes */
.hide {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .register-container__column {
        padding-inline: 0;
    }

    .register-form {
        padding: 25px 0;
        margin-top: 30px;
        margin-bottom: 30px;
    }
    
    .register-form__title {
        font-size: 24px;
        margin-bottom: 30px;
    }
    
    .register-form__group {
        margin-bottom: 20px;
    }
    
    .register-form__input {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .register-form__button {
        padding: 10px 16px;
        font-size: 14px;
    }

    .modal__dialog {
        padding-inline: 20px;
    }
}

/* Backwards compatibility for existing sm-register wrapper */
.sm-register .register-container,
.sm-register .register-form,
.sm-register .modal {
    /* Styles will apply whether wrapped in sm-register or not */
}
