/*
 * MM Form – Frontend Styles
 * BEM naming: .mm-form__element--modifier
 * All selectors use a single class (specificity 0,1,0) to remain overridable.
 */

/* =========================================================================
   Block: mm-form
   ========================================================================= */

.mm-form {
    max-width: 640px;
    margin-inline: auto;
    font-family: inherit;
    color: inherit;
}

/* =========================================================================
   Element: mm-form__step
   ========================================================================= */

.mm-form__step        { display: none; }
.mm-form__step--active { display: block; }

/* =========================================================================
   Element: mm-form__field
   ========================================================================= */

.mm-form__field {
    margin-bottom: 1.125rem;
}

.mm-form__label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    margin-bottom: .375rem;
}

.mm-form__required {
    color: #c0392b;
    margin-left: .125rem;
}

/* =========================================================================
   Element: mm-form__input
   ========================================================================= */

.mm-form__input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: .625rem .875rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    color: inherit;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    appearance: none;
}

.mm-form__input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, .15);
}

.mm-form__input--error {
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, .12);
}

.mm-form__input--valid {
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, .12);
}

/* =========================================================================
   Element: mm-form__otp-wrap  (OTP-style character boxes)
   ========================================================================= */

.mm-form__otp-wrap {
    display: flex;
    gap: .625rem;
    justify-content: flex-start;
    flex-wrap: nowrap;
    margin-bottom: .625rem;
}

.mm-form__otp-char {
    width: 3rem;
    height: 3.5rem;
    padding: 0;
    border: 2px solid #ccc;
    border-radius: 8px;
    background: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: inherit;
    text-align: center;
    color: inherit;
    caret-color: transparent;
    text-transform: uppercase;
    transition: border-color .15s, box-shadow .15s, background .15s;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    flex-shrink: 0;
}

.mm-form__otp-char:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, .18);
    background: #f0f6fc;
}

.mm-form__otp-wrap--valid   .mm-form__otp-char { border-color: #27ae60; box-shadow: 0 0 0 3px rgba(39, 174, 96, .15); }
.mm-form__otp-wrap--invalid .mm-form__otp-char { border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192, 57, 43, .12); }
.mm-form__otp-char--invalid { color: #c0392b; border-color: #c0392b; }
.mm-form__otp-char--valid   { color: #27ae60; border-color: #27ae60; }

@keyframes mm-form-otp-shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

.mm-form__otp-wrap--shake { animation: mm-form-otp-shake .45s ease; }

@media (max-width: 400px) {
    .mm-form__otp-char { width: 2.5rem; height: 3rem; font-size: 1.25rem; }
    .mm-form__otp-wrap { gap: .375rem; }
}

/* =========================================================================
   Element: mm-form__code-banner  (error/warning above OTP)
   ========================================================================= */

.mm-form__code-banner {
    padding: .75rem 1rem;
    border-radius: 8px;
    margin-bottom: .875rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.mm-form__code-banner--error   { background: #fdecea; border: 1px solid #e74c3c; color: #c0392b; }
.mm-form__code-banner--warning { background: #fef9ec; border: 1px solid #e67e22; color: #a04000; }
.mm-form__code-banner-title    { font-weight: 700; font-size: 1rem; }
.mm-form__code-banner-msg      { font-size: .9rem; opacity: .9; }

/* =========================================================================
   Element: mm-form__code-hint
   ========================================================================= */

.mm-form__code-hint {
    margin-top: .625rem;
    font-size: .9rem;
    color: #555;
    line-height: 1.5;
}

/* =========================================================================
   Misc
   ========================================================================= */

.mm-form__required-note { font-size: .8rem; color: #777; margin: -.25rem 0 .5rem; }

/* =========================================================================
   Element: mm-form__field--checkbox
   ========================================================================= */

.mm-form__field--checkbox { margin-top: 1.25rem; }

.mm-form__label--checkbox {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    cursor: pointer;
    font-weight: 400;
}

.mm-form__checkbox {
    flex-shrink: 0;
    margin-top: .125rem;
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
}

.mm-form__checkbox-label       { font-size: .9rem; line-height: 1.5; }
.mm-form__checkbox-label a      { color: inherit; }
.mm-form__field-error           { font-size: .8125rem; color: #c0392b; margin-top: .375rem; min-height: 1rem; }

/* =========================================================================
   Element: mm-form__server-error
   ========================================================================= */

.mm-form__server-error        { font-size: .875rem; color: #c0392b; margin-bottom: 1rem; }
.mm-form__server-error:empty  { display: none; }

/* =========================================================================
   Element: mm-form__actions
   ========================================================================= */

.mm-form__actions,
.mm-form__actions--center {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    margin-top: 1.5rem;
}

/* =========================================================================
   Element: mm-form__btn
   ========================================================================= */

.mm-form__btn {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .65rem 1.5rem;
    border: 2px solid transparent;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s, transform .1s;
    line-height: 1.4;
    text-decoration: none;
}

.mm-form__btn:active { transform: scale(.98); }

.mm-form__btn--primary,
.mm-form__btn--next,
.mm-form__btn--submit {
    background: #1d2327;
    color: #fff;
    border-color: #1d2327;
}

.mm-form__btn--primary:hover:not(:disabled),
.mm-form__btn--next:hover:not(:disabled),
.mm-form__btn--submit:hover:not(:disabled) { opacity: .85; }

.mm-form__btn--primary:disabled,
.mm-form__btn--next:disabled,
.mm-form__btn--submit:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.mm-form__btn--back { background: transparent; color: inherit; border-color: currentColor; opacity: .65; }
.mm-form__btn--back:hover { opacity: 1; }

/* =========================================================================
   Element: mm-form__success
   ========================================================================= */

.mm-form__success { text-align: center; padding: 2.5rem 1.5rem; }

/* =========================================================================
   Element: mm-form__spinner
   ========================================================================= */

.mm-form__spinner {
    display: inline-block;
    width: .875rem;
    height: .875rem;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mm-form-spin .6s linear infinite;
}

@keyframes mm-form-spin { to { transform: rotate(360deg); } }

/* =========================================================================
   Element: mm-form__row  (inline field pairs)
   ========================================================================= */

.mm-form__row {
    display: grid;
    gap: .75rem;
    margin-bottom: 0; /* fields inside carry their own margin */
}

.mm-form__row--7-3 { grid-template-columns: 7fr 3fr; }
.mm-form__row--3-7 { grid-template-columns: 3fr 7fr; }

@media (max-width: 480px) {
    .mm-form__row--7-3,
    .mm-form__row--3-7 { grid-template-columns: 1fr; }
}
