/* استایل ساده موبایل برای فرم فرانت هوش‌نویس */

.wpai-front-wrapper {
    max-width: 640px;
    margin: 1.5rem auto;
    padding: 1rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.06);
    direction: rtl;
    text-align: right;
    font-family: inherit;
}

.wpai-front-form label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.wpai-front-form input[type="text"],
.wpai-front-form input[type="password"],
.wpai-front-form input[type="number"],
.wpai-front-form textarea,
.wpai-front-form select {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.9rem;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.wpai-front-form textarea {
    min-height: 100px;
}

.wpai-front-step {
    display: none;
}

.wpai-front-step-active {
    display: block;
}

.wpai-front-step h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.wpai-front-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.wpai-front-btn {
    border: none;
    border-radius: 999px;
    padding: 0.55rem 1.2rem;
    cursor: pointer;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.wpai-front-btn-primary {
    background: #0055ff;
    color: #ffffff;
}

.wpai-front-btn-secondary {
    background: #f4f4f4;
    color: #222222;
}

.wpai-front-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wpai-front-field {
    margin-bottom: 0.75rem;
}

.wpai-front-radio-group label {
    font-weight: 400;
}

.wpai-front-status {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

/* اعلان‌ها */
.wpai-front-notice {
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.wpai-front-notice-error {
    background: #ffe8e8;
    border: 1px solid #f0b7b7;
}

/* موبایل */
@media (max-width: 480px) {
    .wpai-front-wrapper {
        margin: 0.5rem;
        padding: 0.8rem;
        border-radius: 10px;
    }

    .wpai-front-actions {
        flex-direction: column-reverse;
    }

    .wpai-front-btn {
        width: 100%;
    }
}


/* لیست لینک‌های داخلی */
.wpai-front-int-list {
    max-height: 260px;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid #eeeeee;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}

.wpai-front-checkbox {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.wpai-front-checkbox input[type="checkbox"] {
    margin: 0;
    flex: 0 0 auto;
    transform: scale(1.05);
}

.wpai-front-checkbox span {
    display: inline-block;
}

/* سرچ لیست‌ها */
.wpai-front-search {
    width: 100%;
    border-radius: 999px;
    border: 1px solid #e0e0e0;
    padding: 0.45rem 0.75rem;
    margin-bottom: 0.55rem;
    font-size: 0.9rem;
}


/* Fix 1.2.1: جلوگیری از بیرون‌زدگی فرم و دکمه‌ها در موبایل و قالب‌های دارای CSS سنگین */
.wpai-front-wrapper,
.wpai-front-wrapper * {
    box-sizing: border-box;
}

.wpai-front-wrapper {
    width: min(640px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    overflow: hidden;
    position: relative;
}

.wpai-front-form {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.wpai-front-step {
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.wpai-front-actions,
.wpai-front-actions p {
    width: 100%;
    max-width: 100%;
}

.wpai-front-btn,
.wpai-front-form button,
.wpai-front-form input,
.wpai-front-form textarea,
.wpai-front-form select {
    max-width: 100% !important;
    min-width: 0 !important;
}

.wpai-front-btn {
    position: static !important;
    float: none !important;
    line-height: 1.7;
    min-height: 48px;
    text-decoration: none;
    transform: none !important;
}

.wpai-front-radio-group label,
.wpai-front-field > label,
.wpai-front-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    line-height: 1.9;
    overflow-wrap: anywhere;
}

.wpai-front-radio-group input[type="radio"],
.wpai-front-field input[type="checkbox"] {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin: 0;
}

.wpai-front-status {
    direction: rtl;
    text-align: center;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.9;
}

@media (max-width: 600px) {
    .wpai-front-wrapper {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        margin: 10px auto;
        padding: 14px;
        border-radius: 14px;
    }

    .wpai-front-step h3 {
        font-size: 1rem;
        line-height: 1.8;
        text-align: center;
    }

    .wpai-front-actions {
        display: flex !important;
        flex-direction: column-reverse !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        gap: 10px;
    }

    .wpai-front-btn {
        width: 100% !important;
        padding: 12px 14px;
        font-size: 15px;
    }
}
