/* إعادة تعيين وإعدادات عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c5282;
    --primary-dark: #1a365d;
    --secondary-color: #4a90a4;
    --success-color: #38a169;
    --danger-color: #e53e3e;
    --text-color: #2d3748;
    --text-light: #718096;
    --bg-color: #f7fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Cairo', sans-serif;
    direction: rtl;
    text-align: right;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.8;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* رأس الصفحة */
.header {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
}

.logo p {
    color: var(--text-light);
    font-size: 16px;
}

/* البطاقات */
.card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* الأقسام */
.section {
    display: none;
}

.section.active {
    display: block;
}

.section-title {
    color: var(--primary-color);
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 25px;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-color);
}

/* محتوى الموافقة المستنيرة */
.consent-content {
    line-height: 2;
}

.consent-content h3 {
    color: var(--primary-color);
    font-size: 22px;
    margin-bottom: 15px;
}

.consent-content h4 {
    color: var(--primary-dark);
    font-size: 18px;
    margin-top: 25px;
    margin-bottom: 12px;
    font-weight: 600;
}

.consent-content p {
    margin-bottom: 15px;
    color: var(--text-color);
}

.consent-content ul {
    margin-right: 25px;
    margin-bottom: 20px;
}

.consent-content li {
    margin-bottom: 10px;
    color: var(--text-color);
}

.research-title {
    background: #edf2f7;
    padding: 20px;
    border-radius: 10px;
    border-right: 4px solid var(--primary-color);
    margin: 20px 0;
    font-weight: 600;
    color: var(--primary-dark);
}

.consent-box {
    background: #f7fafc;
    padding: 25px;
    border-radius: 10px;
    margin-top: 30px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 16px;
}

.checkbox-label input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    margin-top: 3px;
    flex-shrink: 0;
}

.checkbox-label span {
    flex: 1;
}

/* النماذج */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-color);
    font-size: 16px;
}

.form-group label.required::after {
    content: " *";
    color: var(--danger-color);
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

/* أزرار الراديو */
.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
    background: white;
}

.radio-label:hover {
    border-color: var(--primary-color);
    background: #f7fafc;
}

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

.radio-label input[type="radio"]:checked+span {
    color: var(--primary-color);
    font-weight: 600;
}

/* التعليمات */
.instructions {
    background: #fff5e6;
    padding: 20px;
    border-radius: 10px;
    border-right: 4px solid #f59e0b;
    margin-bottom: 20px;
}

.instructions p {
    color: var(--text-color);
    font-weight: 500;
}

/* توضيح التصلب اللويحي */
.ms-clarification {
    background: #dcfce7;
    padding: 25px;
    border-radius: 10px;
    border-right: 4px solid #16a34a;
    margin-bottom: 30px;
}

.ms-clarification p {
    color: var(--text-color);
    font-size: 16px;
    line-height: 2;
    margin-bottom: 10px;
}

.ms-clarification p:last-child {
    margin-bottom: 0;
}

.ms-clarification strong {
    color: #15803d;
    font-size: 18px;
}

/* قسم مقياس الدرجات */
.scale-legend-section {
    background: #f0f9ff;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
    border: 2px solid #3b82f6;
}

.scale-legend-section h3 {
    color: var(--primary-color);
    font-size: 18px;
    margin-bottom: 15px;
    text-align: center;
}

/* مقياس الدرجات */
.scale-legend {
    display: flex;
    justify-content: space-around;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.scale-item {
    color: white;
    font-weight: 600;
    text-align: center;
    font-size: 15px;
}

.scale-num {
    display: inline-block;
    background: white;
    color: var(--primary-color);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    line-height: 30px;
    margin-left: 5px;
    font-weight: 700;
}

/* مجموعات الأبعاد */
.dimension-group {
    margin-bottom: 35px;
}

/* عناصر الأسئلة */
.question-item {
    background: #f7fafc;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.question-item:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.question-label {
    display: block;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 15px;
    font-size: 16px;
    line-height: 1.8;
}

.question-number {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    margin-left: 10px;
    font-size: 14px;
}

/* خيارات المقياس */
.scale-options {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

.scale-options label {
    flex: 1;
    min-width: 80px;
    max-width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 15px 10px;
    border: 3px solid var(--border-color);
    border-radius: 12px;
    background: white;
    transition: all 0.3s ease;
    position: relative;
}

.scale-options label::after {
    content: attr(data-label);
    display: block;
    font-size: 13px;
    color: var(--text-light);
    margin-top: 5px;
    text-align: center;
    font-weight: 600;
}

.scale-options label[data-label="إطلاقاً"]::after {
    content: "إطلاقاً";
}

.scale-options label[data-label="نادراً"]::after {
    content: "نادراً";
}

.scale-options label[data-label="أحياناً"]::after {
    content: "أحياناً";
}

.scale-options label[data-label="غالباً"]::after {
    content: "غالباً";
}

.scale-options label[data-label="دائماً"]::after {
    content: "دائماً";
}

.scale-options label:hover {
    border-color: var(--primary-color);
    background: #f0f9ff;
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
}

.scale-options input[type="radio"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    margin: 0;
}

.scale-options input[type="radio"]:checked~span {
    color: white;
    font-weight: 700;
    font-size: 20px;
}

.scale-options label:has(input:checked) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.scale-options label:has(input:checked)::after {
    color: white;
    font-weight: 700;
}

.scale-options label span {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 18px;
}

/* الأزرار */
.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 35px;
    border: none;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(102, 126, 234, 0.5);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* صفحة الشكر */
.thankyou-card {
    text-align: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    margin: 0 auto 25px;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

.thankyou-content {
    font-size: 18px;
    line-height: 2;
}

.thankyou-content p {
    margin-bottom: 15px;
    color: var(--text-color);
}

.reminder-box {
    background: #f0fff4;
    border: 2px solid var(--success-color);
    padding: 20px;
    border-radius: 10px;
    margin-top: 30px;
    text-align: right;
}

.reminder-box strong {
    color: var(--success-color);
}

/* مؤشر التحميل */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 18px;
    font-weight: 600;
}

/* التذييل */
.footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    text-align: center;
    margin-top: 30px;
    border-radius: 15px;
    color: var(--text-light);
}

.footer p {
    margin: 5px 0;
}

/* استجابة للأجهزة المحمولة */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .card {
        padding: 25px;
    }

    .header {
        padding: 20px;
    }

    .logo h1 {
        font-size: 22px;
    }

    .section-title {
        font-size: 22px;
    }

    .consent-content h3 {
        font-size: 20px;
    }

    .consent-content h4 {
        font-size: 16px;
    }

    .scale-legend {
        flex-direction: column;
        align-items: stretch;
    }

    .scale-item {
        padding: 10px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 5px;
        margin-bottom: 5px;
    }

    .scale-options {
        gap: 10px;
    }

    .scale-options label {
        min-width: 50px;
        padding: 8px;
    }

    .button-group {
        flex-direction: column-reverse;
    }

    .btn {
        width: 100%;
    }

    .radio-group {
        flex-direction: column;
    }

    .radio-label {
        width: 100%;
    }

    .scale-options {
        flex-direction: column;
        gap: 12px;
    }

    .scale-options label {
        width: 100%;
        max-width: 100%;
        min-width: 100%;
        flex-direction: row;
        justify-content: space-between;
        padding: 18px 20px;
        gap: 15px;
    }

    .scale-options label::after {
        font-size: 15px;
        margin: 0;
    }

    .scale-options label span {
        font-size: 20px;
        order: -1;
    }
}

/* طباعة */
@media print {
    body {
        background: white;
    }

    .header,
    .footer,
    .button-group {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}

/* التنبيهات المخصصة - Custom Toasts */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    pointer-events: none;
}

.custom-toast {
    display: flex;
    align-items: center;
    background: white;
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    min-width: 300px;
    pointer-events: auto;
}

.custom-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.custom-toast.error {
    border-right: 5px solid var(--danger-color);
}

.custom-toast.success {
    border-right: 5px solid var(--success-color);
}

.toast-icon {
    font-size: 18px;
    margin-left: 15px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.custom-toast.error .toast-icon {
    background: var(--danger-color);
}

.custom-toast.success .toast-icon {
    background: var(--success-color);
}

.toast-message {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-color);
}