/* --- 1. حاوية النموذج بتصميم حديث --- */
#q8it-wizard-wrapper {
    max-width: 850px;
    margin: 50px auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    border: none;
    position: relative;
}

#q8it-wizard-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #7f54b3, #96588a);
    background-color: #96588a; /* لون WooCommerce */
    z-index: 10;
}

/* --- 2. تصميم الحقول بشكل عصري --- */
.q8it-step {
    padding: 40px;
}

.q8it-form-group {
    margin-bottom: 30px !important;
    position: relative;
}

.q8it-form-group label {
    display: block !important;
    margin-bottom: 12px !important;
    font-weight: 600 !important;
    color: #2c3338 !important;
    font-size: 16px !important;
    letter-spacing: -0.2px;
}

.req {
    color: #dc3232;
    margin-left: 3px;
}

/* تنسيق عام لجميع الحقول */
#q8it-wizard-form input:not([type="checkbox"]):not([type="radio"]),
#q8it-wizard-form select,
#q8it-wizard-form textarea {
    width: 100% !important;
    min-height: 56px !important;
    padding: 16px 18px !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    background-color: #f8f9fa !important;
    color: #2c3338 !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 10px !important;
    box-sizing: border-box !important;
    margin-bottom: 0 !important;
    transition: all 0.3s ease;
    font-family: inherit;
}

/* تأثير التركيز على الحقول */
#q8it-wizard-form input:not([type="checkbox"]):not([type="radio"]):focus,
#q8it-wizard-form select:focus,
#q8it-wizard-form textarea:focus {
    outline: none !important;
    border-color: #7f54b3 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(127, 84, 179, 0.1) !important;
}

/* إصلاح القائمة المنسدلة */
#q8it-wizard-form select {
    appearance: auto !important;
    -webkit-appearance: menulist !important;
    -moz-appearance: menulist !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237f54b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 18px center !important;
    padding-right: 50px !important;
    cursor: pointer;
}

/* مربع النص */
#q8it-wizard-form textarea {
    min-height: 140px !important;
    resize: vertical;
    line-height: 1.6 !important;
}

/* --- 3. شريط التقدم المحدث --- */
.q8it-progress-container {
    width: 100%;
    background-color: #f1f3f5;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 40px;
}

.q8it-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #7f54b3, #96588a);
    width: 0%;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 5px;
}

/* مؤشرات الخطوات */
.q8it-step-indicators {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    position: relative;
}

.q8it-step-indicators::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #e2e8f0;
    z-index: 1;
}

.q8it-step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
}

.q8it-step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #f8f9fa;
    border: 3px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #a0aec0;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    font-size: 18px;
}

.q8it-step-indicator.active .q8it-step-number {
    background-color: #7f54b3;
    border-color: #7f54b3;
    color: white;
    transform: scale(1.1);
}

.q8it-step-indicator.completed .q8it-step-number {
    background-color: #38a169;
    border-color: #38a169;
    color: white;
}

.q8it-step-label {
    font-size: 14px;
    color: #a0aec0;
    font-weight: 500;
    text-align: center;
    max-width: 100px;
    transition: color 0.3s ease;
}

.q8it-step-indicator.active .q8it-step-label {
    color: #2c3338;
    font-weight: 600;
}

/* --- 4. تصميم الأزرار الحديث --- */
.q8it-step-footer {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.q8it-step-footer button {
    padding: 0 30px !important;
    border: none !important;
    border-radius: 10px !important;
    font-size: 16px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    height: 56px !important;
    line-height: 56px !important;
    display: inline-block;
    transition: all 0.3s ease;
    letter-spacing: -0.2px;
    position: relative;
    overflow: hidden;
}

/* تأثير hover على الأزرار */
.q8it-step-footer button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.q8it-step-footer button:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

.btn-next, .btn-submit {
    background: linear-gradient(135deg, #7f54b3, #96588a) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(127, 84, 179, 0.2);
}

.btn-next:hover, .btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(127, 84, 179, 0.3);
}

.btn-prev {
    background-color: #f1f3f5 !important;
    color: #4a5568 !important;
    border: 2px solid #e2e8f0 !important;
}

.btn-prev:hover {
    background-color: #e2e8f0 !important;
    border-color: #cbd5e0 !important;
    transform: translateY(-2px);
}

/* زر الإرسال */
.btn-submit {
    background: linear-gradient(135deg, #38a169, #2f855a) !important;
    box-shadow: 0 4px 12px rgba(56, 161, 105, 0.2);
}

.btn-submit:hover {
    box-shadow: 0 6px 16px rgba(56, 161, 105, 0.3);
}

/* --- 5. رسائل النجاح والخطأ المحدثة --- */
.q8it-validation-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 8px;
    font-size: 14px;
    display: none;
}

.q8it-error {
    background-color: #fff5f5;
    color: #c53030;
    border-left: 4px solid #c53030;
}

.q8it-success {
    background-color: #f0fff4;
    color: #2f855a;
    border-left: 4px solid #2f855a;
}

.shake-animation {
    animation: shake 0.4s ease-in-out;
    border-color: #c53030 !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* رسالة نجاح خاصة */
#q8it-success-message {
    background: linear-gradient(135deg, #f0fff4, #e6fffa);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    margin: 30px 0;
    border: 2px solid #c6f6d5;
    display: none;
}

#q8it-success-message h3 {
    color: #2f855a;
    margin-bottom: 15px;
    font-size: 24px;
}

/* --- 6. تحسينات للهواتف المحمولة --- */
@media (max-width: 768px) {
    #q8it-wizard-wrapper {
        margin: 15px;
        border-radius: 12px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    }
    
    .q8it-step {
        padding: 25px;
    }
    
    .q8it-step-indicators {
        margin-bottom: 20px;
    }
    
    .q8it-step-number {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .q8it-step-label {
        font-size: 12px;
        max-width: 80px;
    }
    
    .q8it-step-footer {
        flex-direction: column;
        gap: 15px;
    }
    
    .q8it-step-footer button {
        width: 100%;
    }
    
    #q8it-wizard-form input:not([type="checkbox"]):not([type="radio"]),
    #q8it-wizard-form select,
    #q8it-wizard-form textarea {
        font-size: 16px !important;
        min-height: 52px !important;
        padding: 14px 16px !important;
    }
}

@media (max-width: 480px) {
    .q8it-step {
        padding: 20px;
    }
    
    .q8it-step-indicator {
        padding: 0 5px;
    }
    
    .q8it-step-label {
        font-size: 11px;
    }
}

/* --- 7. تصميم العناوين --- */
.q8it-step-title {
    font-size: 28px;
    color: #2c3338;
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.q8it-step-description {
    font-size: 16px;
    color: #718096;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* --- 8. تأثيرات تحميل --- */
.q8it-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- 9. تحسينات إضافية --- */
.q8it-form-group:last-child {
    margin-bottom: 0 !important;
}

/* تلميح توضيحي للحقول */
.q8it-field-hint {
    font-size: 14px;
    color: #718096;
    margin-top: 8px;
    font-style: italic;
}

/* تظليل الخطوة النشطة */
.q8it-step.active {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0.7; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* إخفاء الخطوات غير النشطة */
.q8it-step:not(.active) {
    display: none;
}