.cuf-form-wrapper {
    width: 100%;
    max-width: 900px;
    margin: 30px auto;
    padding: 30px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
}

.cuf-form-wrapper *,
.cuf-form-wrapper *::before,
.cuf-form-wrapper *::after {
    box-sizing: border-box;
}

.cuf-form-header {
    margin-bottom: 30px;
}

.cuf-form-header h2 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 700;
}

.cuf-form-header p {
    margin: 0;
    color: #6b7280;
}

.cuf-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.cuf-field {
    margin-bottom: 20px;
}

.cuf-field-full {
    grid-column: 1 / -1;
}

.cuf-field label {
    display: block;
    margin-bottom: 8px;
    color: #111827;
    font-size: 15px;
    font-weight: 600;
}

.cuf-field label span {
    color: #dc2626;
}

.cuf-field input,
.cuf-field select,
.cuf-field textarea {
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    color: #111827;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    outline: none;
    font: inherit;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.cuf-field textarea {
    min-height: 110px;
    resize: vertical;
}

.cuf-field input[type="file"] {
    height: auto;
    padding: 12px;
}

.cuf-field input:focus,
.cuf-field select:focus,
.cuf-field textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.cuf-field input.cuf-invalid,
.cuf-field select.cuf-invalid,
.cuf-field textarea.cuf-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.cuf-field small {
    display: block;
    margin-top: 7px;
    color: #6b7280;
    font-size: 12px;
}

.cuf-submit-button,
.cuf-next-button,
.cuf-prev-button {
    min-height: 46px;
    padding: 10px 24px;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    transition:
        transform 0.2s ease,
        opacity 0.2s ease;
}

.cuf-submit-button,
.cuf-next-button {
    color: #ffffff;
    background: #2563eb;
}

.cuf-prev-button {
    color: #374151;
    background: #e5e7eb;
}

.cuf-submit-button:hover,
.cuf-next-button:hover,
.cuf-prev-button:hover {
    transform: translateY(-1px);
}

.cuf-submit-button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.cuf-step-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 15px;
}

.cuf-message {
    display: none;
    width: 100%;
    margin: 20px 0;
    padding: 14px 16px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 500;
}

.cuf-message.success {
    display: block;
    color: #166534;
    background: #dcfce7;
    border: 1px solid #86efac;
}

.cuf-message.error {
    display: block;
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #fca5a5;
}

.cuf-loader {
    display: none;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: cuf-spin 0.7s linear infinite;
}

.cuf-submit-button.loading .cuf-loader {
    display: inline-block;
}

@keyframes cuf-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Multi-step form */

.cuf-step {
    display: none;
}

.cuf-step.active {
    display: block;
    animation: cuf-fade-in 0.25s ease;
}

@keyframes cuf-fade-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cuf-step h3 {
    margin: 0 0 25px;
    font-size: 21px;
}

.cuf-progress {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 35px;
    overflow-x: auto;
}

.cuf-progress-item {
    position: relative;
    flex: 1;
    min-width: 110px;
    color: #9ca3af;
    text-align: center;
}

.cuf-progress-item:not(:last-child)::after {
    position: absolute;
    top: 18px;
    right: calc(50% + 23px);
    width: calc(100% - 46px);
    height: 2px;
    background: #e5e7eb;
    content: "";
}

.cuf-progress-item span {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0 auto 7px;
    color: #6b7280;
    background: #e5e7eb;
    border-radius: 50%;
    font-weight: 700;
}

.cuf-progress-item small {
    display: block;
    white-space: nowrap;
}

.cuf-progress-item.active span,
.cuf-progress-item.completed span {
    color: #ffffff;
    background: #2563eb;
}

.cuf-progress-item.active {
    color: #2563eb;
}

.cuf-progress-item.completed {
    color: #374151;
}

.cuf-progress-item.completed:not(:last-child)::after {
    background: #2563eb;
}

/* Honeypot */

.cuf-honeypot {
    position: absolute !important;
    left: -99999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.cuf-captcha-field {
    max-width: 280px;
}

/* Responsive */

@media (max-width: 767px) {
    .cuf-form-wrapper {
        padding: 20px 15px;
        border-radius: 10px;
    }

    .cuf-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .cuf-field-full {
        grid-column: auto;
    }

    .cuf-form-header h2 {
        font-size: 23px;
    }

    .cuf-step-actions {
        flex-direction: column-reverse;
    }

    .cuf-step-actions button,
    .cuf-submit-button {
        width: 100%;
    }

    .cuf-progress {
        justify-content: flex-start;
    }

    .cuf-progress-item {
        flex: 0 0 115px;
    }

    .cuf-progress-item::after {
        display: none;
    }
}