/**
 * Advanced Forms Manager - Public Styles
 * أنماط الواجهة العامة للنماذج
 */

/* ========== حاوية النموذج ========== */
.afm-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.afm-form-title {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.afm-form-description {
    color: #666;
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* ========== النموذج ========== */
.afm-form {
    direction: rtl;
}

.afm-form-fields {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* ========== الحقول ========== */
.afm-field {
    display: flex;
    flex-direction: column;
}

.afm-field-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 15px;
}

.afm-required {
    color: #dc3545;
    margin-right: 4px;
}

.afm-field-description {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 8px;
}

/* ========== حقول الإدخال ========== */
.afm-input,
.afm-textarea,
.afm-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.afm-input:focus,
.afm-textarea:focus,
.afm-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.afm-textarea {
    resize: vertical;
    min-height: 120px;
}

/* ========== الاختيارات ========== */
.afm-radio-group,
.afm-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.afm-radio-label,
.afm-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.afm-radio-label:hover,
.afm-checkbox-label:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.afm-radio-label input[type="radio"],
.afm-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.afm-radio-label input[type="radio"]:checked + span,
.afm-checkbox-label input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: #667eea;
}

/* ========== رفع الملفات ========== */
.afm-file-input {
    width: 100%;
    padding: 12px;
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.afm-file-input:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.afm-file-info {
    font-size: 13px;
    color: #6c757d;
    margin-top: 8px;
}

/* ========== التقييم ========== */
.afm-rating-group {
    display: flex;
    gap: 5px;
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.afm-rating-label {
    cursor: pointer;
}

.afm-rating-label input[type="radio"] {
    display: none;
}

.afm-star {
    font-size: 32px;
    color: #ddd;
    transition: color 0.2s ease;
}

.afm-rating-label:hover .afm-star,
.afm-rating-label:hover ~ .afm-rating-label .afm-star {
    color: #ffc107;
}

.afm-rating-label input[type="radio"]:checked ~ .afm-star,
.afm-rating-label input[type="radio"]:checked ~ .afm-rating-label .afm-star {
    color: #ffc107;
}

/* ========== الرسائل ========== */
.afm-form-messages {
    margin: 20px 0;
}

.afm-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.afm-message-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.afm-message-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.afm-message-icon {
    font-size: 20px;
}

/* ========== زر الإرسال ========== */
.afm-form-submit {
    margin-top: 30px;
}

.afm-submit-button {
    width: 100%;
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.afm-submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.afm-submit-button:active {
    transform: translateY(0);
}

.afm-submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.afm-button-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.afm-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: afm-spin 0.8s linear infinite;
}

@keyframes afm-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== أخطاء التحقق ========== */
.afm-field.afm-error .afm-input,
.afm-field.afm-error .afm-textarea,
.afm-field.afm-error .afm-select {
    border-color: #dc3545;
}

.afm-field-error {
    color: #dc3545;
    font-size: 13px;
    margin-top: 5px;
}

/* ========== التوافق مع Divi ========== */
.et_pb_module .afm-form-container {
    box-shadow: none;
    padding: 0;
}

.et_pb_module .afm-form-title {
    font-family: inherit;
}

/* ========== الوضع الداكن (اختياري) ========== */
@media (prefers-color-scheme: dark) {
    .afm-form-container {
        background: #1a1a1a;
        color: #fff;
    }
    
    .afm-form-title,
    .afm-field-label {
        color: #fff;
    }
    
    .afm-form-description,
    .afm-field-description {
        color: #aaa;
    }
    
    .afm-input,
    .afm-textarea,
    .afm-select {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .afm-radio-label,
    .afm-checkbox-label {
        border-color: #444;
        color: #fff;
    }
    
    .afm-radio-label:hover,
    .afm-checkbox-label:hover {
        background: #2a2a2a;
    }
}

/* ========== استجابة الشاشات الصغيرة ========== */
@media (max-width: 768px) {
    .afm-form-container {
        padding: 20px;
    }
    
    .afm-form-title {
        font-size: 24px;
    }
    
    .afm-rating-group {
        justify-content: center;
    }
    
    .afm-star {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .afm-form-container {
        padding: 15px;
        border-radius: 8px;
    }
    
    .afm-form-title {
        font-size: 20px;
    }
    
    .afm-submit-button {
        padding: 12px 20px;
        font-size: 15px;
    }
}

