html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: "Cairo", sans-serif;
  background-color: #f8f9fa;
  direction: rtl;
  text-align: right;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

#timer-bar {
  top: 56px;
  z-index: 1020;
}

#app {
  margin-top: 100px;
  flex: 1 0 auto;
}

footer {
  flex-shrink: 0;
}

.container {
  max-width: 800px;
}

.d-none {
  display: none !important;
}

.question-block {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background-color: #ffffff;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
  border: 1px solid #dee2e6;
}

.question-content {
  padding: 1.5rem;
}

.question-text {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.question-image-container {
  border: 1px solid #e0e0e0;
  background-color: #fdfdfd;
  padding: 0.5rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
}

.question-image {
  width: 100%;
  display: block;
  border-radius: 6px;
}

.options-container .list-group-item {
  font-size: 1.1rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
}

.options-container .list-group-item:hover {
  background-color: #f0f0f0;
}

.option-image {
  max-width: 100px;
  max-height: 80px;
  border-radius: 5px;
  margin-left: 15px;
}

.history-attempt-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

.history-attempt-item:last-child {
  border-bottom: none;
}

#result-view .card {
  border: 2px solid #198754;
}

#result-view #score-display {
  font-size: 3rem;
  font-weight: 700;
  color: #198754;
}

.accordion-button:not(.collapsed) {
  background-color: #e7f1ff;
  color: #0c63e4;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.125);
}

.accordion-button:focus {
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.accordion-button {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

.accordion-button::after {
  margin-left: unset;
  margin-right: 0.25rem;
  margin-left: 0.25rem;
}

#welcome-msg .studentName {
  color: #0d6efd;
  font-weight: 700;
  background-color: #e7f1ff;
  padding: 2px 8px;
  border-radius: 5px;
}

.dashboard-section-wrapper {
  margin-bottom: 1.5rem;
  border-radius: 8px;
  overflow: hidden;
  background-color: #ffffff;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.section-header {
  background-color: #f0f2f5;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
}

.section-title {
  margin-bottom: 0;
  font-size: 1.25rem;
  color: #333;
  display: flex;
  align-items: center;
}

.section-icon {
  font-size: 1.1rem;
  margin-left: 0.75rem;
  color: #007bff;
}

#flagged-questions-list + .section-header .section-icon {
  color: #ffc107;
}
#available-quizzes-list + .section-header .section-icon {
  color: #17a2b8;
}
#student-history-list + .section-header .section-icon {
  color: #6c757d;
}

.section-content {
  padding: 0.5rem 1rem;
}

.flagged-item,
.history-item {
  border: 1px solid #e9ecef;
  border-radius: 5px;
}

.history-item:not(:last-child) {
  border-bottom: 1px solid #dee2e6;
  margin-top: 5px;
  margin-bottom: 5px;
}

.accordion-body > .row {
  margin: 0 !important;
}

.accordion-body .col-6 {
  padding: 0.25rem !important;
}

.accordion-item {
  border: none;
  background-color: transparent;
  margin-bottom: 0.25rem;
}

.accordion-button {
  background-color: #e9ecef !important;
  color: #333 !important;
  border-radius: 5px !important;
  padding: 0.75rem 1rem;
}

.accordion-button:not(.collapsed) {
  background-color: #dee2e6 !important;
  color: #000 !important;
}

.accordion-button:focus {
  box-shadow: none !important;
}

hr {
  display: none;
}

#timer-container {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.2rem;
}

h1 {
  display: none;
}

#navbar-student-name {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

.question-block-highlight {
  border: 2px solid #dc3545;
  box-shadow: 0 0 15px rgba(220, 53, 69, 0.4);
  transition: all 0.3s ease-in-out;
}

#scroll-to-bottom-btn {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 50px;
  height: 50px;
  background-color: #0d6efd;
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  transition: background-color 0.2s;
}
#scroll-to-bottom-btn:hover {
  background-color: #0b5ed7;
}

#scroll-to-top-btn {
  position: fixed;
  bottom: 140px; /* الموضع الجديد */
  right: 20px;
  width: 50px;
  height: 50px;
  background-color: #0d6efd;
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  transition: background-color 0.2s;
}
#scroll-to-top-btn:hover {
  background-color: #0b5ed7;
}

#historyAccordion .accordion-body,
#flaggedAccordion .accordion-body {
  padding: 0 !important;
}

.skeleton-card {
  background-color: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.skeleton-line {
  height: 1.2rem;
  border-radius: 4px;
  background-color: #e0e0e0;
  animation: placeholder-glow 1.8s ease-in-out infinite;
}

.skeleton-line.short {
  width: 60%;
}

.options-container .list-group-item {
  position: relative;
  padding-right: 50px;
  border-width: 2px;
  border-radius: 10px !important;
  margin-bottom: 10px;
  transition: all 0.2s ease-in-out;
}

.options-container .form-check-input {
  display: none;
}

.options-container .list-group-item::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 2px solid #adb5bd;
  border-radius: 6px;
  background-color: #f8f9fa;
}

.options-container .list-group-item::after {
  content: "✔";
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  font-size: 22px;
  font-weight: bold;
  color: white;
  opacity: 0;
  transition: opacity 0.2s;
}

.options-container .list-group-item.option-selected {
  background-color: #e7f1ff;
  border-color: #0d6efd;
  color: #000;
  font-weight: bold;
}

.options-container .list-group-item.option-selected::before {
  background-color: #0d6efd;
  border-color: #0a58ca;
  border-width: 3px;
}

.options-container .list-group-item.option-selected::after {
  opacity: 1;
}

.feedback-options .list-group-item {
  position: relative;
  padding-left: 60px !important;
  border-width: 2px !important;
}

.feedback-options .correct-answer {
  background-color: #d1e7dd !important;
  border-color: #198754 !important;
}

.feedback-options .wrong-answer {
  background-color: #f8d7da !important;
  border-color: #dc3545 !important;
}

.feedback-options .list-group-item::after {
  opacity: 1 !important;
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  font-size: 1.6rem;
}

.feedback-options .list-group-item.correct-answer::after {
  content: "\f058";
  color: #198754;
}

.feedback-options .list-group-item.wrong-answer::after {
  content: "\f057";
  color: #dc3545;
}

.feedback-question-block {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background-color: #ffffff;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
  border: 1px solid #dee2e6;
}

.attempts-tracker i {
  font-size: 1.1rem;
  margin: 0 2px;
}

.input-group {
  direction: rtl;
}

.input-group > .input-group-text {
  border-radius: 0 0.375rem 0.375rem 0 !important;
}

.input-group > .form-control {
  border-radius: 0.375rem 0 0 0.375rem !important;
}

/* نقل زر إغلاق النوافذ المنبثقة إلى اليسار */
.modal-header .btn-close {
  margin-left: 0;
  margin-right: auto;
}

.code-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px; /* مسافة بين الكود والزر */
}

.copy-code-btn {
  flex-shrink: 0; /* منع الزر من الانكماش */
}

/* تعديل التنسيق في الوضع المكدس للجوال */
@media (max-width: 992px) {
  #student-list-container td[data-label="الكود:"] .code-container {
    justify-content: flex-end; /* محاذاة المحتوى (الكود والزر) لليسار */
  }
}

/* ---== *** تصميم تقسيم الخيارات في نافذة مراجعة الأسئلة المعلمة *** ==--- */

.review-option-letter {
  flex: 0 0 10%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  background-color: #f8f9fa;
  border-left: 1px solid #dee2e6;
}

.review-option-content {
  flex: 0 0 90%;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
}

/* تنسيق حاوية زر التحقق والرسالة */
.check-answer-container {
  display: flex;
  align-items: center;
  gap: 1rem; /* مسافة بين الزر والرسالة */
  min-height: 31px; /* لضمان عدم اهتزاز التنسيق عند ظهور الرسالة */
}

/* تنسيق رسالة التغذية الراجعة */
.check-answer-feedback {
  font-weight: bold;
  transition: opacity 0.3s ease-in-out;
}

.check-answer-feedback.correct {
  color: #198754; /* Green */
}

.check-answer-feedback.incorrect {
  color: #dc3545; /* Red */
}

#contact-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background-color: #198754; /* لون أخضر مختلف */
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  transition: background-color 0.2s;
}
#contact-fab:hover {
  background-color: #157347;
}

/* إخفاء زر التواصل افتراضياً */
#contact-fab {
  display: none;
}

/* تنسيق جديد ومتجاوب للجزء السفلي من السؤال */
.question-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap; /* السماح بالتفاف العناصر */
  gap: 0.5rem; /* إضافة مسافة بين العناصر */
  margin-top: 1.5rem;
}

.question-meta-tags {
  display: flex;
  align-items: center;
}

/* تنسيق خاص بالشاشات الصغيرة (الجوال) */
@media (max-width: 576px) {
  .question-footer {
    /* flex-direction: column;  */
    /* جعل العناصر مكدسة عمودياً */
    align-items: stretch; /* جعل العناصر تمتد بعرض الحاوية */
  }

  .check-answer-container {
    justify-content: center; /* توسيط زر التحقق والرسالة */
    margin-bottom: 0.5rem;
  }

  .question-meta-tags {
    justify-content: center; /* توسيط الشارات */
  }
}

/* تنسيق جديد ومتجاوب لرأس صفحة المراجعة */
.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.review-header-buttons {
  display: flex;
  gap: 0.5rem;
}

/* === Responsive Design for Mobile Student View (Final) === */
@media (max-width: 768px) {
  /* 1. تصغير حجم الخط العام والأزرار */
  body {
    font-size: 0.875rem;
  }
  .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
  }
  .btn-lg {
    padding: 0.5rem 1rem;
    font-size: 1rem;
  }

  /* 2. استثناء الأزرار الرئيسية */
  #login-btn,
  #signup-btn,
  #change-password-student-btn,
  #logout-student-btn,
  #submit-quiz-btn {
    padding: 0.5rem 1rem;
    font-size: 1rem;
  }

  /* ✅ 3. تصغير أزرار الانتقال داخل الاختبار */
  #prev-btn,
  #next-btn {
    padding: 0.5rem;
    font-size: 0.75rem;
  }

  /* 4. تحسين كروت الإحصائيات */
  #stats-container .card-body {
    display: flex;
    flex-direction: row;
    justify-content: flex-start; /* الأيقونة في البداية */
    align-items: center; /* توسيط عمودي */
    padding: 0.5rem 0.5rem;
    gap: 0.5rem; /* مسافة بين الأيقونة ومجموعة النصوص */
  }

  #stats-container .card-body i.fas {
    font-size: 1.2rem; /* حجم الأيقونة */
    flex-shrink: 0; /* منع الأيقونة من الانكماش */
  }

  #stats-container .card-body .stats-text {
    flex-grow: 1; /* جعل مجموعة النصوص تملأ المساحة المتبقية */
    text-align: right; /* محاذاة النصوص لليمين */
  }

  #stats-container .card-body h5 {
    font-size: 1.5rem; /* تكبير الرقم قليلاً */
    margin-bottom: 0.1rem; /* مسافة صغيرة تحت الرقم */
    line-height: 1.2;
  }

  #stats-container .card-body p {
    font-size: 0.7rem;
    margin-bottom: 0;
    line-height: 1;
    display: block !important;
  }

  /* 5. تحسين عرض قوائم الاختبارات والمحاولات */
  #available-quizzes-list .card-body,
  .history-item .d-flex.justify-content-around,
  .flagged-item-row {
    /* flex-direction: column; */
    align-items: stretch;
    text-align: center;
    gap: 0.75rem;
  }
  #available-quizzes-list .attempts-tracker {
    margin: 0 !important;
  }
  .flagged-question-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  /* 6. تصغير خطوط وأزرار الاختيار داخل الاختبار */
  .question-text {
    font-size: 1rem;
  }
  .options-container .list-group-item {
    font-size: 0.95rem;
  }
  /* ✅ تصغير زر الاختيار الدائري */
  .options-container .list-group-item::before {
    width: 24px;
    height: 24px;
  }
  .options-container .list-group-item::after {
    font-size: 18px;
    right: 18px;
  }

  /* 7. تصغير الأزرار العائمة */
  #contact-fab,
  #scroll-to-top-btn,
  #scroll-to-bottom-btn {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    right: 15px;
  }
  #contact-fab {
    bottom: 15px;
  }
  #scroll-to-bottom-btn {
    bottom: 65px;
  }
  #scroll-to-top-btn {
    bottom: 115px;
  }

  /* 8. تصغير نصوص المودالات */
  .modal-title {
    font-size: 1.1rem !important;
  }
  .modal-body,
  .modal-body p,
  .modal-body div,
  .modal-body li,
  .modal-body span {
    font-size: 0.9rem !important;
  }
}

/* === Fixed Size for Menu Toggle Button (For ALL Screens) === */
/* ✅ تم نقل هذا الكود خارج الميديا كويري ليكون أقوى */
#menu-toggle-btn {
  width: 44px;
  height: 44px;
  padding: 0 !important; /* استخدام !important لضمان عدم التأثر */
  font-size: 1.25rem !important;
}

.offcanvas-header .btn-close {
  margin-right: auto;
  margin-left: 0;
}
