/* الألوان الرئيسية للمنصة */
:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --accent-color: #9b59b6;
    --light-color: #ecf0f1;
    --dark-color: #34495e;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #1abc9c;
    --text-color: #2c3e50;
    --border-color: #bdc3c7;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* إعدادات عامة */
body {
    font-family: 'Tajawal', 'Cairo', sans-serif;
    background-color: #f5f7fa;
    color: var(--text-color);
    direction: rtl;
    text-align: right;
}

/* الشريط العلوي */
.navbar {
    background-color: var(--primary-color);
    box-shadow: 0 2px 10px var(--shadow-color);
}

.navbar-brand {
    font-weight: bold;
    color: white !important;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    margin: 0 10px;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: white !important;
    transform: translateY(-2px);
}

.navbar-nav .active .nav-link {
    color: white !important;
    border-bottom: 2px solid white;
}

/* البطاقات */
.card {
    border-radius: 10px;
    border: none;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: all 0.3s ease;
    margin-bottom: 20px;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    border-bottom: none;
    font-weight: bold;
    padding: 15px 20px;
}

.card-body {
    padding: 20px;
}

/* البطاقات المتخصصة */
.card.card-patient {
    border-top: 4px solid var(--primary-color);
}

.card.card-assessment {
    border-top: 4px solid var(--secondary-color);
}

.card.card-diagnosis {
    border-top: 4px solid var(--accent-color);
}

.card.card-treatment {
    border-top: 4px solid var(--info-color);
}

.card.card-appointment {
    border-top: 4px solid var(--warning-color);
}

/* الأزرار */
.btn {
    border-radius: 5px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px var(--shadow-color);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: #27ae60;
    border-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-accent {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.btn-accent:hover {
    background-color: #8e44ad;
    border-color: #8e44ad;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* النماذج */
.form-control {
    border-radius: 5px;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--dark-color);
}

/* الجداول */
.table {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.table thead th {
    background-color: var(--primary-color);
    color: white;
    border-bottom: none;
    font-weight: 500;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(52, 152, 219, 0.05);
}

.table-hover tbody tr:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

/* تنسيق التواريخ والأوقات في المواعيد */
.appointment-date {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.appointment-date .fw-bold {
    color: #2c3e50;
    font-size: 14px;
    margin-bottom: 2px;
    line-height: 1.2;
}

.appointment-date .text-muted {
    color: #6c757d !important;
    font-size: 11px;
    font-style: italic;
}

.appointment-time {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1976d2;
    border: 1px solid #2196f3;
    border-radius: 15px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    transition: all 0.2s ease;
}

.appointment-time:hover {
    background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%);
    transform: scale(1.05);
}

/* تحسين تنسيق حالات المواعيد */
.badge.bg-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%) !important;
    color: #856404 !important;
    border: 1px solid #ffeaa7;
}

.badge.bg-success {
    background: linear-gradient(135deg, #d4edda 0%, #a3d977 100%) !important;
    color: #155724 !important;
    border: 1px solid #a3d977;
}

.badge.bg-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f093a0 100%) !important;
    color: #721c24 !important;
    border: 1px solid #f093a0;
}

/* تنسيق تفاصيل الموعد */
.appointment-details-date {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
}

.appointment-details-time {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1976d2;
    border: 1px solid #2196f3;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 16px;
    font-weight: 600;
    display: inline-block;
}

/* الشارات */
.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.badge-primary {
    background-color: var(--primary-color);
}

.badge-secondary {
    background-color: var(--secondary-color);
}

.badge-accent {
    background-color: var(--accent-color);
    color: white;
}

.badge-warning {
    background-color: var(--warning-color);
    color: white;
}

.badge-danger {
    background-color: var(--danger-color);
    color: white;
}

.badge-info {
    background-color: var(--info-color);
    color: white;
}

/* لوحة المعلومات */
.dashboard-stats {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.stat-card {
    flex: 1;
    min-width: 200px;
    margin: 10px;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow-color);
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.stat-card.patients {
    background-color: var(--primary-color);
    color: white;
}

.stat-card.assessments {
    background-color: var(--secondary-color);
    color: white;
}

.stat-card.appointments {
    background-color: var(--warning-color);
    color: white;
}

.stat-card.diagnoses {
    background-color: var(--accent-color);
    color: white;
}

.stat-card h3 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 1.1rem;
    margin: 0;
    opacity: 0.9;
}

/* تذييل الصفحة */
footer {
    background-color: var(--dark-color);
    color: white;
    padding: 20px 0;
    margin-top: 50px;
}

footer a {
    color: var(--light-color);
}

footer a:hover {
    color: white;
    text-decoration: none;
}

/* تخصيص للشاشات الصغيرة */
@media (max-width: 768px) {
    .dashboard-stats {
        flex-direction: column;
    }

    .stat-card {
        margin-bottom: 15px;
    }
}

/* أنيميشن للتحميل */
.loading {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* تنسيق الرسائل */
.alert {
    border-radius: 10px;
    border: none;
    box-shadow: 0 5px 15px var(--shadow-color);
    padding: 15px 20px;
}

.alert-success {
    background-color: rgba(46, 204, 113, 0.2);
    color: #27ae60;
}

.alert-danger {
    background-color: rgba(231, 76, 60, 0.2);
    color: #c0392b;
}

.alert-warning {
    background-color: rgba(243, 156, 18, 0.2);
    color: #d35400;
}

.alert-info {
    background-color: rgba(52, 152, 219, 0.2);
    color: #2980b9;
}

/* تنسيق الصفحة الرئيسية */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 80px 0;
    margin-bottom: 50px;
    border-radius: 0 0 50% 50% / 20px;
}

.hero-section h1 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 20px;
}

.hero-section p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 30px;
}

/* تنسيق صفحة تسجيل الدخول */
.login-container {
    max-width: 400px;
    margin: 50px auto;
}

.login-card {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px var(--shadow-color);
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 30px;
    text-align: center;
}

.login-header h2 {
    margin: 0;
    font-weight: bold;
}

.login-body {
    padding: 30px;
}

/* تنسيق الملف الشخصي */
.profile-header {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px var(--shadow-color);
    display: flex;
    align-items: center;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin-left: 20px;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info h2 {
    margin: 0 0 10px 0;
    color: var(--dark-color);
}

.profile-info p {
    margin: 0;
    color: var(--text-color);
    opacity: 0.8;
}

/* تنسيق المقاييس النفسية */
.assessment-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.assessment-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.assessment-card .card-text {
    flex: 1;
    margin-bottom: 15px;
}

.assessment-card .btn {
    align-self: flex-start;
}

/* تنسيق صفحة المريض */
.patient-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.patient-info {
    display: flex;
    flex-wrap: wrap;
}

.patient-info-item {
    flex: 1;
    min-width: 200px;
    margin-bottom: 20px;
    padding-left: 20px;
}

.patient-info-item h6 {
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 5px;
}

.patient-info-item p {
    font-weight: 500;
    margin: 0;
}

/* تنسيق التقارير */
.report-section {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.report-section h3 {
    margin-top: 0;
    margin-bottom: 20px;

/* تنسيق الخطة العلاجية الاحترافية */
.treatment-plan-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.treatment-plan-header {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.3);
}

.treatment-plan-header h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.treatment-plan-header .plan-meta {
    margin-top: 10px;
    opacity: 0.9;
    font-size: 0.95rem;
}

/* أقسام الخطة العلاجية */
.treatment-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border-left: 5px solid var(--primary-color);
    transition: all 0.3s ease;
}

.treatment-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.treatment-section h3 {
    color: var(--primary-color);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    align-items: center;
}

.treatment-section h3 i {
    margin-left: 10px;
    font-size: 1.2rem;
}

.treatment-section h4 {
    color: var(--accent-color);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 20px 0 15px 0;
}

.treatment-section h5 {
    color: var(--dark-color);
    font-size: 1.1rem;
    font-weight: 500;
    margin: 15px 0 10px 0;
}

/* جدول الجلسات العلاجية */
.sessions-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.sessions-table th {
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    color: white;
    padding: 15px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
}

.sessions-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
    line-height: 1.6;
}

.sessions-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.sessions-table tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

.session-number {
    background: var(--accent-color);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin: 0 auto;
}

.session-title {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.session-duration {
    background: var(--info-color);
    color: white;
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 0.8rem;
    display: inline-block;
}

/* قوائم الأهداف والتقنيات */
.treatment-list {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.treatment-list li {
    background: #f8f9fa;
    margin: 8px 0;
    padding: 12px 15px;
    border-radius: 8px;
    border-right: 4px solid var(--secondary-color);
    transition: all 0.3s ease;
    position: relative;
}

.treatment-list li:hover {
    background: #e9ecef;
    transform: translateX(-5px);
}

.treatment-list li:before {
    content: "✓";
    color: var(--secondary-color);
    font-weight: bold;
    margin-left: 10px;
}

.treatment-sub-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 10px 20px;
}

.treatment-sub-list li {
    background: #e9ecef;
    border-right: 4px solid var(--warning-color);
    font-size: 0.9rem;
}

.treatment-sub-list li:before {
    content: "→";
    color: var(--warning-color);
}

/* شارات المقاييس */
.assessment-badge {
    background: linear-gradient(135deg, var(--info-color), #16a085);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 3px;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(26, 188, 156, 0.3);
}

/* مؤشرات التقدم */
.progress-indicator {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border: 2px solid var(--secondary-color);
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
    position: relative;
}

.progress-indicator:before {
    content: "📊";
    position: absolute;
    top: -10px;
    right: 15px;
    background: var(--secondary-color);
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* توصيات إضافية */
.recommendation-card {
    background: linear-gradient(135deg, #fff5f5, #ffe6e6);
    border: 2px solid var(--danger-color);
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
}

.recommendation-card h6 {
    color: var(--danger-color);
    font-weight: 600;
    margin-bottom: 10px;
}

/* جدول المتابعة */
.follow-up-table {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.follow-up-table th {
    background: var(--warning-color);
    color: white;
    padding: 12px;
    font-weight: 600;
}

.follow-up-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
}

/* تنسيق الطباعة */
@media print {
    .treatment-plan-container {
        box-shadow: none;
        background: white;
    }

    .treatment-section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .sessions-table {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* تنسيق إضافي للجلسات */
.sessions-container {
    margin: 30px 0;
}

.sessions-container h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 600;
}

.session-goals, .session-techniques {
    list-style: none;
    padding: 0;
    margin: 0;
}

.session-goals li, .session-techniques li {
    background: #f8f9fa;
    margin: 3px 0;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    border-right: 3px solid var(--secondary-color);
}

.session-techniques li {
    border-right-color: var(--info-color);
}

.homework-text {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--dark-color);
}

/* تحسين responsive للجدول */
@media (max-width: 1200px) {
    .sessions-table {
        font-size: 0.85rem;
    }

    .sessions-table th, .sessions-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 768px) {
    .sessions-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* تنسيق الرسوم البيانية */
.chart-container {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px var(--shadow-color);
}

/* تنسيق جدول المواعيد */
.calendar-container {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.calendar-day {
    background-color: var(--light-color);
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
}

.calendar-day h5 {
    margin: 0 0 10px 0;
    color: var(--dark-color);
}

.appointment-item {
    background-color: white;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
    border-right: 4px solid var(--primary-color);
    box-shadow: 0 2px 5px var(--shadow-color);
}

.appointment-time {
    font-weight: bold;
    color: var(--primary-color);
}

.appointment-patient {
    font-weight: 500;
}

/* تنسيق صفحة الاختبار النفسي */
.question-container {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px var(--shadow-color);
}

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

.question-text {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.options-container {
    margin-right: 40px;
}

.option-item {
    margin-bottom: 15px;
}

.option-item label {
    cursor: pointer;
    display: block;
    padding: 10px 15px;
    background-color: var(--light-color);
    border-radius: 5px;
    transition: all 0.3s ease;
}

.option-item label:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

.option-item input[type="radio"]:checked + label {
    background-color: var(--primary-color);
    color: white;
}

.option-item input[type="radio"] {
    display: none;
}

/* تنسيق نتائج الاختبار */
.result-summary {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px var(--shadow-color);
    text-align: center;
}

.result-score {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.result-interpretation {
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding: 10px;
    background-color: rgba(52, 152, 219, 0.1);
    border-radius: 5px;
}

/* تنسيق الخطة العلاجية */
.treatment-timeline {
    position: relative;
    padding-right: 30px;
}

.treatment-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 10px;
    width: 2px;
    background-color: var(--primary-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    top: 0;
    right: -30px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--primary-color);
}

.timeline-content {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.timeline-date {
    display: inline-block;
    padding: 5px 10px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

/* تنسيق صفحة التشخيص */
.diagnosis-container {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.diagnosis-code {
    display: inline-block;
    padding: 5px 10px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 5px;
    margin-bottom: 10px;
}

.diagnosis-text {
    font-size: 1.1rem;
    line-height: 1.6;
}

/* تنسيق النوافذ المنبثقة */
.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.modal-header {
    background-color: var(--primary-color);
    color: white;
    border-bottom: none;
    padding: 15px 20px;
}

.modal-title {
    font-weight: bold;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 15px 20px;
}

.close-modal-btn {
    cursor: pointer;
}

.diagnosis-modal .modal-header {
    background-color: var(--accent-color);
}

/* إصلاح مشكلة النوافذ المنبثقة */
.modal-backdrop {
    z-index: 1040;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal {
    z-index: 1050;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
}

/* تأكيد أن النافذة المنبثقة تظهر في المنتصف */
.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    pointer-events: none;
    max-width: 500px;
}

.modal-lg {
    max-width: 800px;
}

/* تأكيد أن أزرار الإغلاق تعمل بشكل صحيح */
.close-modal-btn, .custom-modal-close {
    cursor: pointer !important;
}

/* تحسين مظهر النافذة المنبثقة */
.modal-content {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* تنسيق الإشعارات */
.notification-badge {
    position: relative;
    display: inline-block;
}

.notification-badge .badge {
    position: absolute;
    top: -8px;
    left: -8px;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    padding: 0;
    line-height: 20px;
    text-align: center;
    background-color: var(--danger-color);
    color: white;
    font-size: 0.8rem;
}

/* نظام التنبيهات العصري */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.modern-toast {
    background: white;
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    margin-bottom: 12px;
    overflow: hidden;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 4px solid;
    backdrop-filter: blur(10px);
    min-height: 80px;
}

.modern-toast.show {
    transform: translateX(0);
}

.modern-toast.hide {
    transform: translateX(100%);
    opacity: 0;
}

.modern-toast.success {
    border-left-color: #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.modern-toast.error {
    border-left-color: #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.modern-toast.warning {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.modern-toast.info {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.toast-header {
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 16px 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.toast-icon.success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.toast-icon.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast-icon.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.toast-icon.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    margin: 0;
    flex-grow: 1;
}

.toast-close {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #374151;
}

.toast-body {
    padding: 0 20px 16px;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.5;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.8));
    border-radius: 0 0 12px 12px;
    transition: width linear;
}

.toast-progress.success {
    background: linear-gradient(90deg, #10b981, #059669);
}

.toast-progress.error {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.toast-progress.warning {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.toast-progress.info {
    background: linear-gradient(90deg, #3b82f6, #2563eb);
}

/* تأثيرات الحركة */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.modern-toast:hover {
    transform: translateX(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* تنسيق للشاشات الصغيرة */
@media (max-width: 768px) {
    .toast-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .modern-toast {
        margin-bottom: 8px;
    }
}

/* تنسيق الصور المصغرة */
.thumbnail {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-block;
    margin-left: 10px;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* تنسيق الأيقونات */
.icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background-color: rgba(52, 152, 219, 0.1);
    color: var(--primary-color);
    margin-left: 10px;
    transition: all 0.3s ease;
}

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

/* تنسيق الشريط الجانبي */
.sidebar {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px var(--shadow-color);
    height: 100%;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin-bottom: 10px;
}

.sidebar-menu a {
    display: block;
    padding: 10px 15px;
    border-radius: 5px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-menu a:hover {
    background-color: rgba(52, 152, 219, 0.1);
    color: var(--primary-color);
}

.sidebar-menu a.active {
    background-color: var(--primary-color);
    color: white;
}

.sidebar-menu i {
    margin-left: 10px;
}

/* تنسيق الصفحات الفرعية */
.page-header {
    margin-bottom: 30px;
}

.page-header h2 {
    margin: 0 0 10px 0;
    color: var(--dark-color);
}

.page-header p {
    margin: 0;
    color: var(--text-color);
    opacity: 0.7;
}

/* تنسيق الزر العائم */
.floating-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1000;
}

.floating-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    background-color: #2980b9;
}

.floating-btn i {
    font-size: 24px;
}

/* تنسيق الصفحة غير الموجودة */
.error-container {
    text-align: center;
    padding: 50px 0;
}

.error-code {
    font-size: 8rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.error-message {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: var(--text-color);
}

/* تنسيق الطباعة */
@media print {
    .no-print,
    .navbar,
    footer,
    .btn,
    .floating-btn,
    .card-header button,
    .collapse:not(.show) {
        display: none !important;
    }

    body {
        background-color: white;
        padding: 0;
        margin: 0;
    }

    .card, .report-section, .diagnosis-container {
        box-shadow: none !important;
        border: 1px solid #ddd;
        margin-bottom: 20px;
        page-break-inside: avoid;
    }

    .container {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    /* ضمان ظهور التفسير في الطباعة */
    .alert {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        box-shadow: none !important;
        border: 1px solid #ddd;
    }

    /* ضمان ظهور الإجابات التفصيلية */
    #detailedAnswers {
        display: block !important;
    }

    /* تنسيق خاص بصفحة نتيجة المقياس */
    .result-score, .progress, .result-interpretation {
        page-break-inside: avoid;
    }
}
