/* ==========================================================================
   Motrjim hosted forms — standalone (no app.css dependency), RTL, mobile first.
   Accent & radius come from each form's settings via --mf-accent / --mf-radius.
   ========================================================================== */
.mf-root {
    --mf-ink: #1f2430;
    --mf-muted: #6b7280;
    --mf-line: #e3e7ee;
    --mf-bg: #ffffff;
    --mf-field: #f6f8fb;
    --mf-danger: #d14343;
    --mf-danger-bg: #fdeeee;
    --mf-success: #1f9d55;
    font-family: 'Cairo', 'Tajawal', system-ui, sans-serif;
    color: var(--mf-ink);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    box-sizing: border-box;
}
.mf-root *, .mf-root *::before, .mf-root *::after { box-sizing: border-box; }
.mf-card { background: var(--mf-bg); border: 1px solid var(--mf-line); border-radius: calc(var(--mf-radius) + 8px); padding: 28px 24px; box-shadow: 0 14px 40px rgba(28, 39, 61, .08); }
.mf-head { margin-bottom: 20px; }
.mf-title { margin: 0 0 6px; font-size: 22px; font-weight: 800; line-height: 1.35; }
.mf-desc { margin: 0; color: var(--mf-muted); font-size: 14px; }

.mf-grid { display: flex; flex-wrap: wrap; gap: 16px 14px; }
.mf-field { flex: 1 1 100%; min-width: 0; }
.mf-field.mf-half { flex: 1 1 calc(50% - 7px); }
.mf-field[hidden] { display: none; }
.mf-label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 6px; }
.mf-req { color: var(--mf-danger); }
.mf-help { font-size: 12px; color: var(--mf-muted); margin-top: 5px; }
.mf-input {
    width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--mf-line); border-radius: var(--mf-radius);
    background: var(--mf-field); color: var(--mf-ink); font-family: inherit; font-size: 15px; font-weight: 500; line-height: 1.4; transition: border-color .15s, box-shadow .15s, background .15s;
    -webkit-appearance: none; appearance: none;
}
select.mf-input { background-image: linear-gradient(45deg, transparent 50%, #8b929c 50%), linear-gradient(135deg, #8b929c 50%, transparent 50%); background-position: 18px 50%, 13px 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-left: 34px; }
textarea.mf-input { min-height: 96px; resize: vertical; }
.mf-input[dir="ltr"] { text-align: right; }
.mf-input::placeholder { color: #a3a9b3; }
.mf-input:focus { outline: none; border-color: var(--mf-accent); background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--mf-accent) 16%, transparent); }
.mf-choices { display: flex; flex-direction: column; gap: 8px; }
.mf-check { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--mf-line); border-radius: var(--mf-radius); background: var(--mf-field); cursor: pointer; font-size: 14px; font-weight: 600; transition: border-color .15s, background .15s; }
.mf-check:hover { border-color: color-mix(in srgb, var(--mf-accent) 45%, var(--mf-line)); }
.mf-check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--mf-accent); }
.mf-check:has(input:checked) { border-color: var(--mf-accent); background: color-mix(in srgb, var(--mf-accent) 7%, #fff); }
.mf-consent { background: transparent; border-style: dashed; font-weight: 500; font-size: 13px; }
.mf-heading h3 { margin: 8px 0 0; font-size: 16px; font-weight: 800; padding-bottom: 6px; border-bottom: 1px solid var(--mf-line); }
.mf-paragraph p { margin: 0; color: var(--mf-muted); font-size: 14px; }

.mf-error { display: none; color: var(--mf-danger); font-size: 12.5px; font-weight: 700; margin-top: 6px; }
.mf-invalid .mf-error { display: block; }
.mf-invalid .mf-input, .mf-invalid .mf-check { border-color: var(--mf-danger); background: var(--mf-danger-bg); }
.mf-alert { background: var(--mf-danger-bg); color: var(--mf-danger); border-radius: var(--mf-radius); padding: 10px 14px; font-size: 13.5px; font-weight: 700; margin-bottom: 14px; }

.mf-submit {
    display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; margin-top: 22px;
    border: none; border-radius: var(--mf-radius); background: var(--mf-accent); color: #fff; font-family: inherit; font-size: 16px; font-weight: 800;
    cursor: pointer; text-decoration: none; transition: transform .12s, box-shadow .12s, opacity .12s;
}
.mf-submit:hover { transform: translateY(-1px); box-shadow: 0 10px 22px color-mix(in srgb, var(--mf-accent) 35%, transparent); }
.mf-submit:disabled { opacity: .7; cursor: wait; transform: none; }
.mf-spinner { display: none; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: mf-spin .7s linear infinite; }
.mf-loading .mf-spinner { display: inline-block; }
@keyframes mf-spin { to { transform: rotate(360deg); } }
.mf-brand { text-align: center; font-size: 11.5px; color: var(--mf-muted); margin-top: 12px; }
.mf-hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; white-space: nowrap; }

.mf-result { text-align: center; padding: 18px 6px 6px; animation: mf-pop .35s ease; }
.mf-result-icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; font-weight: 800; background: color-mix(in srgb, var(--mf-success) 14%, #fff); color: var(--mf-success); }
.mf-result.is-duplicate .mf-result-icon { background: color-mix(in srgb, var(--mf-accent) 12%, #fff); color: var(--mf-accent); }
.mf-result-closed .mf-result-icon { background: #eef1f5; color: var(--mf-muted); }
.mf-result-title { margin: 0 0 8px; font-size: 20px; font-weight: 800; }
.mf-result-msg, .mf-result-closed p { margin: 0 auto; max-width: 460px; color: var(--mf-muted); font-size: 15px; white-space: pre-line; }
.mf-result-cta { max-width: 320px; margin: 18px auto 0; }
[hidden], .mf-result-cta[hidden], .mf-again[hidden] { display: none !important; }
.mf-again { margin-top: 14px; background: none; border: none; color: var(--mf-muted); font-family: inherit; font-size: 13px; font-weight: 700; text-decoration: underline; cursor: pointer; }
@keyframes mf-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 560px) {
    .mf-card { padding: 22px 16px; }
    .mf-field.mf-half { flex-basis: 100%; }
    .mf-title { font-size: 19px; }
}

/* Embedded (iframe) & page wrappers */
.mf-page { min-height: 100vh; margin: 0; background: #eef2f7; display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; }
.mf-page .mf-root { width: 100%; max-width: 640px; }
.mf-embed { margin: 0; background: transparent; padding: 2px; }
.mf-embed .mf-card { box-shadow: none; }
