.fprf-form-wrapper {
    --fprf-primary: #6c4dff;
    --fprf-primary-soft: #f1ecff;
    --fprf-text: #1f2330;
    --fprf-muted: #8b93a7;
    --fprf-border: #e6e8ef;
    --fprf-bg: #f5f6fa;
    --fprf-card: #ffffff;
    --fprf-radius-card: 20px;
    --fprf-radius-field: 12px;
    --fprf-radius-btn: 12px;
    --fprf-danger: #e5484d;
    direction: rtl;
    font-family: inherit;
    color: var(--fprf-text);
    max-width: 920px;
    margin: 0 auto;
}

.fprf-form-card {
    background: var(--fprf-card);
    border-radius: var(--fprf-radius-card);
    box-shadow: 0 12px 40px rgba(31, 35, 48, 0.08);
    border: 1px solid rgba(230, 232, 239, 0.9);
    overflow: hidden;
}

.fprf-form-header {
    text-align: center;
    padding: 28px 28px 8px;
}

.fprf-form-title {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 700;
    color: var(--fprf-text);
    line-height: 1.3;
}

.fprf-form-subtitle {
    margin: 0;
    color: var(--fprf-muted);
    font-size: 14px;
    line-height: 1.7;
}

.fprf-stepper {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0;
    padding: 20px 28px 8px;
}

.fprf-stepper-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-width: 72px;
    text-align: center;
}

.fprf-stepper-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--fprf-border);
    background: #fff;
    color: var(--fprf-muted);
    transition: all 0.25s ease;
}

.fprf-stepper-label {
    font-size: 12px;
    color: var(--fprf-muted);
    line-height: 1.4;
    max-width: 90px;
}

.fprf-stepper-line {
    flex: 1 1 auto;
    height: 0;
    border-top: 2px dotted #d7dbe7;
    margin: 24px 8px 0;
    min-width: 16px;
}

.fprf-stepper-item.is-active .fprf-stepper-circle,
.fprf-stepper-item.is-done .fprf-stepper-circle {
    background: var(--fprf-primary);
    border-color: var(--fprf-primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(108, 77, 255, 0.28);
}

.fprf-stepper-item.is-active .fprf-stepper-label {
    color: var(--fprf-primary);
    font-weight: 600;
}

.fprf-stepper-item.is-done .fprf-stepper-label {
    color: var(--fprf-text);
}

.fprf-step-meta {
    padding: 8px 28px 0;
}

.fprf-step-counter {
    display: block;
    font-size: 13px;
    color: var(--fprf-muted);
    margin-bottom: 8px;
}

.fprf-progress {
    background: #eceef5;
    border-radius: 999px;
    overflow: hidden;
    height: 6px;
}

.fprf-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--fprf-primary), #8b6cff);
    transition: width 0.3s ease;
    border-radius: 999px;
}

.fprf-form {
    padding: 20px 28px 8px;
}

.fprf-step-title {
    margin: 0 0 18px;
    font-size: 18px;
    font-weight: 700;
    color: var(--fprf-text);
}

.fprf-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 14px;
}

.fprf-field {
    margin: 0;
}

.fprf-field-wide {
    grid-column: 1 / -1;
}

.fprf-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #3a4050;
}

.fprf-required {
    color: var(--fprf-danger);
    margin-left: 4px;
}

.fprf-input-wrap {
    position: relative;
}

.fprf-field-icon {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: #a0a7b8;
    pointer-events: none;
    display: inline-flex;
}

.fprf-field-textarea .fprf-field-icon {
    top: 16px;
    transform: none;
}

.fprf-field input[type="text"],
.fprf-field input[type="email"],
.fprf-field input[type="tel"],
.fprf-field input[type="number"],
.fprf-field input[type="date"],
.fprf-field textarea,
.fprf-field select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--fprf-border);
    border-radius: var(--fprf-radius-field);
    background: #fff;
    color: var(--fprf-text);
    font: inherit;
    font-size: 14px;
    line-height: 1.5;
    padding: 12px 44px 12px 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
}

.fprf-field textarea {
    min-height: 110px;
    resize: vertical;
}

.fprf-field select {
    background-image: linear-gradient(45deg, transparent 50%, #9aa3b5 50%),
        linear-gradient(135deg, #9aa3b5 50%, transparent 50%);
    background-position: calc(100% - 34px) calc(50% - 3px), calc(100% - 28px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-left: 36px;
}

.fprf-field input:focus,
.fprf-field textarea:focus,
.fprf-field select:focus {
    border-color: var(--fprf-primary);
    box-shadow: 0 0 0 3px rgba(108, 77, 255, 0.12);
}

.fprf-field input.fprf-has-error,
.fprf-field textarea.fprf-has-error,
.fprf-field select.fprf-has-error {
    border-color: var(--fprf-danger);
}

.fprf-upload {
    position: relative;
    border: 2px dashed #c9b8ff;
    border-radius: var(--fprf-radius-field);
    background: #faf8ff;
    min-height: 150px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.fprf-upload:hover,
.fprf-upload.is-dragover {
    border-color: var(--fprf-primary);
    background: var(--fprf-primary-soft);
}

.fprf-upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.fprf-upload-inner {
    pointer-events: none;
    text-align: center;
    padding: 28px 16px;
}

.fprf-upload-icon {
    color: var(--fprf-primary);
    display: inline-flex;
    margin-bottom: 10px;
}

.fprf-upload-title {
    margin: 0 0 6px;
    color: var(--fprf-primary);
    font-weight: 600;
    font-size: 14px;
}

.fprf-upload-hint,
.fprf-upload-filename {
    margin: 0;
    color: var(--fprf-muted);
    font-size: 12px;
}

.fprf-upload-filename {
    margin-top: 8px;
    color: var(--fprf-text);
    font-weight: 600;
}

.fprf-step-actions {
    margin-top: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.fprf-actions-spacer {
    flex: 1;
}

.fprf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--fprf-radius-btn);
    border: 1px solid transparent;
    padding: 12px 20px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.2;
}

.fprf-btn-primary {
    background: var(--fprf-primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(108, 77, 255, 0.25);
}

.fprf-btn-primary:hover {
    filter: brightness(1.05);
}

.fprf-btn-secondary {
    background: #fff;
    color: #3a4050;
    border-color: var(--fprf-border);
}

.fprf-btn-secondary:hover {
    background: #f8f9fc;
}

.fprf-btn-icon {
    display: inline-flex;
}

.fprf-privacy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    padding: 14px 20px;
    background: var(--fprf-primary-soft);
    color: #5a4bb5;
    font-size: 12px;
    text-align: center;
}

.fprf-privacy-icon {
    display: inline-flex;
    color: var(--fprf-primary);
}

.fprf-message {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
}

.fprf-success {
    background: #e7f7ed;
    color: #006e2e;
}

.fprf-error,
.fprf-error-inline {
    background: #fdeeee;
    color: #b00020;
    border: 1px solid #f5c2c7;
}

.fprf-error-inline {
    margin-top: 6px;
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 8px;
}

.fprf-loading {
    opacity: 0.65;
    pointer-events: none;
}

/* Auth popup after form submit */
.fprf-auth-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.fprf-auth-modal[hidden] {
    display: none !important;
}

.fprf-auth-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
}

.fprf-auth-dialog {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(17, 24, 39, 0.18);
    padding: 22px 22px 20px;
    direction: rtl;
    font-family: inherit;
    box-sizing: border-box;
}

.fprf-auth-inline {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 12px 0;
}

.fprf-auth-inline .fprf-auth-dialog {
    box-shadow: 0 12px 40px rgba(17, 24, 39, 0.1);
    border: 1px solid #e5e7eb;
}

.fprf-auth-back-spacer {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    visibility: hidden;
}

.fprf-account-guest {
    width: 100%;
}

body.fprf-auth-open {
    overflow: hidden;
}

.fprf-auth-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.fprf-auth-brand {
    text-align: right;
    flex: 1;
}

.fprf-auth-brand-title {
    color: #6f52ed;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
}

.fprf-auth-brand-sub {
    color: #9ca3af;
    font-size: 13px;
    margin-top: 4px;
}

.fprf-auth-back {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0 !important;
    margin: 0;
    border: none !important;
    border-radius: 10px !important;
    background: #f3f4f6 !important;
    background-image: none !important;
    color: #4b5563 !important;
    -webkit-text-fill-color: #4b5563 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: none !important;
    text-indent: 0 !important;
    font-size: 16px !important;
    line-height: 1 !important;
    overflow: visible !important;
}

.fprf-auth-back-svg,
.fprf-auth-back svg {
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px;
    min-height: 20px;
    stroke: currentColor !important;
    fill: none !important;
    color: #4b5563 !important;
    flex-shrink: 0;
    visibility: visible !important;
    opacity: 1 !important;
}

.fprf-auth-back-icon {
    display: none !important;
}

.fprf-auth-heading {
    margin: 0 0 14px;
    text-align: center;
    font-size: 20px !important;
    font-weight: 800;
    color: #111827 !important;
    line-height: 1.4 !important;
}

.fprf-auth-divider {
    border-top: 1px dashed #e5e7eb;
    margin: 0 0 18px;
}

.fprf-auth-label {
    display: block !important;
    margin-bottom: 8px;
    font-size: 13px !important;
    color: #6b7280 !important;
    text-align: right;
    line-height: 1.5 !important;
}

.fprf-auth-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 15px !important;
    font-family: inherit;
    color: #111827 !important;
    outline: none;
    line-height: 1.4 !important;
}

.fprf-auth-input:focus {
    border-color: #377cf6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(55, 124, 246, 0.15);
}

.fprf-auth-panel .fprf-auth-btn,
.fprf-auth-dialog .fprf-auth-btn,
.fprf-auth-inline .fprf-auth-btn,
button.fprf-auth-btn,
button.fprf-auth-send-otp,
button.fprf-auth-verify-otp {
    width: 100%;
    margin-top: 14px;
    border: none !important;
    border-radius: 14px !important;
    padding: 14px 16px !important;
    background: #6f52ed !important;
    background-image: none !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    font-family: inherit !important;
    line-height: 1.5 !important;
    cursor: pointer;
    box-shadow: none !important;
    text-indent: 0 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    opacity: 1 !important;
    min-height: 52px;
    height: auto !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow: visible !important;
    white-space: normal !important;
    text-shadow: none !important;
    mix-blend-mode: normal !important;
}

.fprf-auth-btn .fprf-auth-btn-label,
.fprf-auth-btn-label {
    display: inline !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.5 !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
    clip: auto !important;
    clip-path: none !important;
    overflow: visible !important;
}

/* Fallback if label node is emptied by theme/script */
.fprf-auth-btn-label:empty::before {
    content: attr(data-label);
    color: #ffffff !important;
}

.fprf-auth-btn:has(.fprf-auth-btn-label:empty)::before,
.fprf-auth-btn:not(:has(.fprf-auth-btn-label))::before {
    content: attr(data-label);
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
}

.fprf-auth-btn:disabled {
    opacity: 0.65 !important;
    cursor: wait;
}

.fprf-auth-btn:hover:not(:disabled) {
    filter: brightness(0.96);
}

.fprf-auth-terms {
    margin: 14px 0 0;
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.7;
}

.fprf-auth-msg {
    margin: 12px 0 0;
    text-align: center;
    font-size: 13px;
    color: #065f46;
}

.fprf-auth-msg.is-error {
    color: #b91c1c;
}

.fprf-auth-phone-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
}

.fprf-auth-phone-display {
    font-weight: 700;
    color: #111827;
    font-size: 15px;
}

.fprf-auth-edit-phone {
    border: none;
    background: transparent;
    color: #2563eb;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    border-right: 1px solid #d1d5db;
    padding-right: 10px;
}

.fprf-auth-otp-row {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 10px;
    align-items: stretch;
}

.fprf-auth-timer {
    background: #f3f4f6;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #374151;
    font-weight: 700;
    font-size: 13px;
}

.fprf-auth-code {
    background: #fff;
    border-color: #377cf6;
}

.fprf-auth-step-otp .fprf-auth-btn {
    background: #2563eb !important;
}

.fprf-auth-resend {
    display: block;
    width: 100%;
    margin-top: 10px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}

.fprf-auth-resend:disabled {
    opacity: 0.45;
    cursor: default;
}

@media (max-width: 720px) {
    .fprf-form-header,
    .fprf-stepper,
    .fprf-step-meta,
    .fprf-form {
        padding-left: 16px;
        padding-right: 16px;
    }

    .fprf-form-title {
        font-size: 22px;
    }

    .fprf-fields-grid {
        grid-template-columns: 1fr;
    }

    .fprf-stepper-label {
        font-size: 11px;
        max-width: 64px;
    }

    .fprf-stepper-circle {
        width: 40px;
        height: 40px;
    }

    .fprf-step-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .fprf-btn {
        width: 100%;
    }
}
