/*
 * Responsive form, signup, and profile overrides.
 */

/* Tablet */

@media (max-width: 1024px) {
    .mls-form-wrapper {
        max-width: 520px;
        margin: 30px auto;
        padding: 24px;
    }

    .mls-profile-wrapper {
        max-width: calc(100% - 40px);
        margin: 30px auto;
        padding: 24px;
    }

    .mls-profile-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;
    }

    .mls-profile-hero-actions,
    .mls-profile-hero-actions .mls-button {
        width: 100%;
    }

    .mls-interest-options {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

/* Mobile */

@media (max-width: 767px) {
    .mls-form-wrapper,
    .mls-profile-wrapper {
        max-width: none;
        margin: 16px 12px;
        padding: 20px;
        border-radius: 14px;
    }

    .mls-form-wrapper h2,
    .mls-profile-wrapper h2 {
        font-size: 22px;
    }

    .mls-form input[type="text"],
    .mls-form input[type="email"],
    .mls-form input[type="password"],
    .mls-form input[type="tel"],
    .mls-form input[type="date"],
    .mls-form select,
    .mls-unlock-form input[type="text"],
    .mls-forgot-form input[type="text"],
    .mls-profile-edit-form input[type="text"],
    .mls-profile-edit-form input[type="date"],
    .mls-profile-edit-form input[type="file"] {
        padding: 12px 14px;
        font-size: 16px;
    }

    .mls-progress {
        gap: 8px;
        margin-bottom: 18px;
    }

    .mls-progress-step {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .mls-signup-form .mls-step .mls-next-button,
    .mls-signup-form .mls-step .mls-back-button,
    .mls-signup-form .mls-step .mls-finish-button {
        width: auto !important;
        min-height: 46px;
        margin: 0 8px 8px 0 !important;
        padding: 12px 16px !important;
        font-size: 16px;
    }

    #mls-signup-form .mls-step-actions {
        gap: 10px;
    }

    #mls-signup-form .mls-step-actions button {
        flex: 1;
        min-width: 0;
        min-height: 46px;
        margin: 0 !important;
    }

    .mls-interest-fieldset {
        padding: 14px;
    }

    .mls-interest-options {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .mls-interest-option {
        padding: 10px 12px;
        border: 1px solid var(--mls-border);
        border-radius: 10px;
        background: #ffffff;
    }

    .mls-interest-option,
    .mls-form label.mls-interest-option,
    .mls-profile-edit-form label.mls-interest-option {
        align-items: flex-start;
    }

    .mls-interest-option input {
        margin-top: 2px;
    }

    .mls-phone-prefix {
        padding: 0 10px;
        font-size: 15px;
    }

    .mls-phone-field input {
        padding: 12px;
        font-size: 16px;
    }

    .mls-profile-hero {
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
        padding-bottom: 20px;
    }

    .mls-profile-hero-left {
        flex-direction: column;
        align-items: center;
        gap: 14px;
        text-align: center;
    }

    .mls-profile-hero-info {
        text-align: center;
    }

    .mls-profile-hero-info h2 {
        font-size: 23px;
    }

    .mls-profile-badges {
        justify-content: center;
    }

    .mls-profile-hero-actions,
    .mls-profile-hero-actions .mls-button {
        width: 100%;
    }

    .mls-profile-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-top: 18px;
    }

    .mls-profile-card {
        padding: 16px;
    }

    .mls-profile-card-full {
        grid-column: auto;
    }

    .mls-info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
        padding: 10px 0;
    }

    .mls-info-label {
        font-size: 13px;
        letter-spacing: 0.03em;
        text-transform: uppercase;
    }

    .mls-info-value {
        font-size: 15px;
        text-align: left;
    }

    .mls-profile-footer {
        text-align: center;
    }

    .mls-logout-link {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }

    .mls-edit-header {
        flex-direction: column;
        align-items: stretch;
    }

    .mls-edit-header .mls-button {
        width: 100%;
        box-sizing: border-box;
    }

    .mls-photo-edit {
        flex-direction: column;
        align-items: center;
        gap: 14px;
        text-align: center;
    }

    .mls-photo-upload {
        width: 100%;
    }

    .mls-edit-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .mls-edit-actions .mls-button,
    .mls-edit-actions button {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Small phones */

@media (max-width: 400px) {
    .mls-form-wrapper,
    .mls-profile-wrapper {
        margin: 12px 8px;
        padding: 16px;
    }

    .mls-profile-avatar {
        width: 76px;
        height: 76px;
    }

    .mls-profile-avatar span {
        font-size: 28px;
    }

    .mls-profile-hero-info h2 {
        font-size: 21px;
    }

    .mls-profile-card {
        padding: 14px;
    }

    .mls-badge {
        padding: 5px 10px;
        font-size: 12px;
    }

    .mls-interest-tag {
        font-size: 12px;
    }

    /*
     * Keep Back/Next aligned as in the final rules of the
     * original stylesheet, allowing wrapping on narrow screens.
     */
    #mls-signup-form .mls-step-actions {
        flex-wrap: wrap;
    }

    #mls-signup-form .mls-step-actions button {
        padding-right: 12px !important;
        padding-left: 12px !important;
    }
}