/* === 1. General Body & Font Styles === */
body {
  font-family: "Cairo", sans-serif;
  background-color: #f8f9fa;
}

/* === 2. Navbar & Offcanvas Sidebar === */
#navbar-admin-email {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

.offcanvas-header .btn-close {
  margin-right: auto;
  margin-left: 0;
}

/* Sidebar Navigation Links (Full-Width Strip Style) */
.offcanvas-body .nav-link {
  width: 100%;
  text-align: right;
  padding: 1rem 1.5rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  border-radius: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: background-color 0.2s ease;
}

.offcanvas-body .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.offcanvas-body .nav-link.active {
  background-color: #0d6efd;
  color: #fff;
  font-weight: 700;
  border-bottom-color: #0d6efd;
  border-left: 4px solid #ffc107;
  padding-right: calc(1.5rem - 4px);
}

.offcanvas-body .nav-link i.fas {
  width: 25px;
  margin-left: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

.offcanvas-body .nav-link.active i.fas,
.offcanvas-body .nav-link:hover i.fas {
  color: #fff;
}

/* === 3. Main Tabs & Content === */
.nav-pills .nav-link {
  font-weight: 600;
}

.tab-content {
  border: 1px solid #dee2e6;
  border-top: 0;
  padding: 1.5rem;
  border-radius: 0 0 0.375rem 0.375rem;
  background-color: #fff;
}

/* === 4. Tables Styling === */
/* General Table Styles */
.table-responsive {
  max-height: 450px; /* زيادة الارتفاع قليلاً */
}
.table-responsive:has(.dropdown-menu.show) {
  overflow: visible;
}

/* Question Bank Table */
.question-bank-table {
  min-width: 900px;
}
.question-bank-table th:nth-child(1),
.question-bank-table th:nth-child(3),
.question-bank-table th:nth-child(8) {
  width: 5%;
}
.question-bank-table th:nth-child(5) {
  width: 30%;
}
.options-cell {
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
}

/* Metadata Cell in Question Bank */
.question-bank-table .metadata-cell {
  min-width: 220px;
}
.metadata-cell .meta-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.25rem;
  white-space: normal;
}
.metadata-cell .meta-item:last-child {
  margin-bottom: 0;
}
.metadata-cell .meta-item i {
  margin-left: 0.5rem;
}
.metadata-cell .meta-item span {
  font-size: 0.85em;
}

/* Error Analysis Table */
.error-analysis-table {
  min-width: 750px;
}
.error-analysis-table span[title] {
  cursor: help;
  text-decoration: underline dotted;
}

/* === 5. Chart & Statistics Styles === */
.chart-container {
  max-height: 400px;
  position: relative;
}

.student-flag-accordion-btn {
  display: flex;
  align-items: center;
  width: 100%;
}
.student-flag-accordion-btn::after {
  order: 1;
  margin-left: 0.75rem;
}
.student-flag-accordion-btn .question-count-badge {
  order: 2;
  flex-shrink: 0;
  min-width: 40px;
  margin-left: 0.75rem;
}
.student-flag-accordion-btn .student-name {
  order: 3;
  text-align: right;
  flex-grow: 1;
}

/* === 6. Modal & Dropdown Styles === */
.modal-header .btn-close {
  margin-left: auto;
  margin-right: -0.5rem;
}
.dropdown-menu {
  text-align: right;
}
.dropdown-item i.fa-fw {
  width: 20px;
}

/* Incorrect Answers Modal */
.incorrect-answer-card {
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
  background-color: #f8f9fa;
}
.answers-comparison {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.answer-item {
  border-radius: 0.375rem;
  overflow: hidden;
}
.answer-header {
  padding: 0.5rem 0.75rem;
  color: #fff;
  display: flex;
  align-items: center;
}
.answer-body {
  padding: 0.75rem;
  background-color: #fff;
}
.answer-wrong .answer-header {
  background-color: #dc3545;
}
.answer-wrong {
  border: 1px solid #dc3545;
}
.answer-correct .answer-header {
  background-color: #198754;
}
.answer-correct {
  border: 1px solid #198754;
}

/* === 7. Responsive Design (for Mobile) === */
@media (max-width: 768px) {
  body {
    font-size: 0.875rem;
  }
  .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
  }
  .btn-lg {
    padding: 0.5rem 1rem;
    font-size: 1rem;
  }

  #login-btn,
  #change-password-admin-btn,
  #logout-admin-btn {
    padding: 0.5rem 1rem;
    font-size: 1.15rem;
  }

  .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;
  }

  #stats-container .card-body {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    padding: 0.75rem;
    gap: 0.75rem;
  }
  #stats-container .card-body i.fas {
    font-size: 1.8rem;
  }
  #stats-container .card-body .stats-text {
    text-align: right;
  }
  #stats-container .card-body h5 {
    font-size: 1.3rem;
    margin-bottom: 0;
  }
  #stats-container .card-body p {
    font-size: 0.75rem;
    margin-bottom: 0;
    display: block !important;
  }

  .answers-comparison {
    grid-template-columns: 1fr;
  }
}

/* === 8. Fixed Size Buttons === */
#menu-toggle-btn {
  width: 44px;
  height: 44px;
  padding: 0 !important;
  font-size: 1.25rem !important;
}
