/* نمط الفورم الرئيسي */
.csr-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.csr-form-container h3 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 700;
    border-bottom: 3px solid #3498db;
    padding-bottom: 15px;
}

.csr-form {
    direction: rtl;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background-color: #fafafa;
    box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group input[type="tel"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* حقل رقم الهاتف المركب */
.form-group input[type="tel"] {
    width: calc(100% - 120px);
    margin-right: 10px;
}

.form-group select[name="country_code"] {
    width: 110px;
    display: inline-block;
    vertical-align: top;
}

/* مجموعات الراديو */
.radio-group {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.radio-group label {
    margin-bottom: 10px !important;
    font-weight: 500 !important;
    color: #495057;
}

.radio-group label:first-child {
    font-weight: 600 !important;
    color: #34495e;
    margin-bottom: 15px !important;
    display: block;
}

.radio-group input[type="radio"] {
    margin-left: 8px;
    margin-right: 0;
    transform: scale(1.2);
    accent-color: #3498db;
}

.radio-group label:not(:first-child) {
    display: inline-block;
    margin-left: 20px;
    margin-bottom: 5px !important;
    cursor: pointer;
    font-weight: 400 !important;
}

/* زر الإرسال */
.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.submit-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1e6091 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
}

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

/* رسائل النتائج */
#csr-form-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
}

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

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

/* تحسينات للأجهزة المحمولة */
@media (max-width: 768px) {
    .csr-form-container {
        margin: 10px;
        padding: 20px;
        border-radius: 10px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .csr-form-container h3 {
        font-size: 24px;
    }
    
    .form-group input[type="tel"] {
        width: 100%;
        margin-right: 0;
        margin-top: 10px;
    }
    
    .form-group select[name="country_code"] {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .radio-group label:not(:first-child) {
        display: block;
        margin-left: 0;
        margin-bottom: 10px !important;
    }
}

/* تأثيرات التحميل */
.csr-form.loading {
    opacity: 0.7;
    pointer-events: none;
}

.csr-form.loading .submit-btn {
    background: #95a5a6;
    cursor: not-allowed;
}

.csr-form.loading .submit-btn:after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

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

/* تحسين شكل الـ Select */
.form-group select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' 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");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 16px;
    padding-left: 40px;
    appearance: none;
}

/* إضافة أيقونات للحقول */
.form-group.with-icon {
    position: relative;
}

.form-group.with-icon:before {
    content: "";
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 2;
}

.form-group.name-field:before {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3e%3cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'%3e%3c/path%3e%3ccircle cx='12' cy='7' r='4'%3e%3c/circle%3e%3c/svg%3e");
}

.form-group.phone-field:before {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3e%3cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z'%3e%3c/path%3e%3c/svg%3e");
}

/* تحسين التباعد العمودي */
.csr-form > *:last-child {
    margin-bottom: 0;
}

/* إضافة تأثير hover للحقول */
.form-group input[type="text"]:hover,
.form-group input[type="tel"]:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: #bdc3c7;
}

/* تحسين شكل الراديو المحدد */
.radio-group input[type="radio"]:checked + label {
    color: #3498db;
    font-weight: 600;
}

/* إضافة تأثير متدرج للخلفية */
.csr-form-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

/* تحسين المظهر العام */
* {
    box-sizing: border-box;
}

.csr-form-container * {
    font-family: inherit;
}

/* أنماط صفحات العرض والتعديل */
.csr-view-page {
    background: #f8f9fa;
    min-height: 100vh;
    padding: 20px 0;
}

.csr-view-container {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.csr-view-header {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.csr-view-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.csr-view-content {
    padding: 30px;
}

.csr-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.csr-info-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.csr-info-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.csr-info-card h3 {
    margin: 0 0 15px 0;
    color: #0073aa;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.csr-info-table {
    width: 100%;
    border-collapse: collapse;
}

.csr-info-table td {
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}

.csr-info-table td:first-child {
    width: 40%;
    font-weight: 600;
    color: #495057;
}

.csr-info-table td:last-child {
    color: #212529;
}

.csr-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.csr-actions {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.csr-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.csr-btn-primary {
    background: #0073aa;
    color: white;
}

.csr-btn-primary:hover {
    background: #005a87;
    color: white;
    text-decoration: none;
}

.csr-btn-secondary {
    background: #6c757d;
    color: white;
}

.csr-btn-secondary:hover {
    background: #5a6268;
    color: white;
    text-decoration: none;
}

.csr-edit-form {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 30px;
    margin: 20px 0;
}

.csr-edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.csr-form-group {
    margin-bottom: 20px;
}

.csr-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

.csr-form-group input,
.csr-form-group select,
.csr-form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.csr-form-group input:focus,
.csr-form-group select:focus,
.csr-form-group textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.csr-readonly-section {
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    padding: 20px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 20px;
}

.csr-editable-section {
    background: #f0f8ff;
    border-left: 4px solid #28a745;
    padding: 20px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 20px;
}

.csr-notes-section {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 20px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 20px;
}

.csr-details-section {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 20px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 20px;
}

.csr-submit-actions {
    background: #f8f9fa;
    padding: 20px;
    border-top: 1px solid #e9ecef;
    text-align: right;
    margin: 20px -30px -30px -30px;
    border-radius: 0 0 8px 8px;
}

/* تحسينات إضافية للجداول */
.csr-info-table tr:last-child td {
    border-bottom: none;
}

.csr-icon {
    font-size: 16px;
    margin-left: 5px;
}

/* متجاوب */
@media (max-width: 768px) {
    .csr-info-grid,
    .csr-edit-grid {
        grid-template-columns: 1fr;
    }
    
    .csr-actions {
        flex-direction: column;
    }
    
    .csr-btn {
        text-align: center;
        justify-content: center;
    }
    
    .csr-view-content {
        padding: 20px;
    }
    
    .csr-submit-actions {
        margin: 20px -20px -20px -20px;
    }
}

/* أنماط خاصة بالحالات */
