/* Clinic dashboard: bilingual sidebar and full-height consultation/emergency forms.
   Independent of light/dark mode and public header. */

/* كل النوافذ (Modals): التمرير داخل الحقول مع بقاء أزرار الإجراء ظاهرة. */
.modal .modal-dialog {
  max-height: calc(100dvh - 24px);
  margin-block: 12px;
}
.modal .modal-content {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 24px) !important;
  overflow: hidden;
}
.modal .modal-content > form {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.modal .modal-header,
.modal .modal-footer {
  flex: 0 0 auto;
}
.modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto !important;
  max-height: none !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
}
.modal .modal-footer {
  background: var(--bs-modal-bg, var(--bs-body-bg, #fff));
  z-index: 1;
  border-top: 1px solid var(--bs-border-color, #e2e8f0);
}
@media (max-height: 600px), (max-width: 575.98px) {
  .modal .modal-dialog {margin-block: 6px;}
  .modal .modal-content {
    max-height: calc(100dvh - 12px) !important;
  }
}


/* القوائم المنسدلة والقوائم الجانبية القابلة للتمرير */
.dropdown-menu { max-height: 60vh; overflow-y: auto; }
.offcanvas-body { overflow-y: auto; }
#dashboardSidebar { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.modal .list-group[id$="SearchResults"], .modal [id$="Results"] { max-height: 240px; overflow-y: auto; }

/* The existing RTL dashboard sidebar is fixed on the right. In English,
   mirror the SIDEBAR AND the room reserved for it, rather than text only. */
html[dir="ltr"] body[data-notification-role="admin"] #dashboardSidebar,
html[dir="ltr"] body[data-notification-role="patient"] #dashboardSidebar {
  direction: ltr !important;
  text-align: left;
  left: 0 !important;
  right: auto !important;
  border-left: 0 !important;
  border-right: 1px solid rgba(255,255,255,.12) !important;
}
html[dir="ltr"] body[data-notification-role="admin"] #dashboardSidebar .sidebar-menu a,
html[dir="ltr"] body[data-notification-role="patient"] #dashboardSidebar .sidebar-menu a {
  direction: ltr;
  text-align: left;
}
html[dir="ltr"] body[data-notification-role="admin"] #dashboardSidebar .sidebar-heading,
html[dir="ltr"] body[data-notification-role="patient"] #dashboardSidebar .sidebar-heading {
  direction: ltr;
}
@media (min-width: 992px) {
  html[dir="ltr"] body[data-notification-role="admin"] .dashboard-layout,
  html[dir="ltr"] body[data-notification-role="patient"] .dashboard-layout {
    padding-left: 280px !important;
    padding-right: 0 !important;
  }
  html[dir="ltr"] body[data-notification-role="admin"] .admin-topbar,
  html[dir="ltr"] body[data-notification-role="patient"] .admin-topbar {
    left: 280px !important;
    right: 0 !important;
    width: calc(100% - 280px) !important;
  }
  html[dir="ltr"] body[data-notification-role="admin"] .clinic-preferences,
  html[dir="ltr"] body[data-notification-role="patient"] .clinic-preferences {
    left: calc(280px + 14px) !important;
    right: auto !important;
  }
}
@media (max-width: 991.98px) {
  html[dir="ltr"] body[data-notification-role="admin"] #dashboardSidebar,
  html[dir="ltr"] body[data-notification-role="patient"] #dashboardSidebar {
    transform: translateX(-100%);
  }
  html[dir="ltr"] body[data-notification-role="admin"] #dashboardSidebar.show,
  html[dir="ltr"] body[data-notification-role="patient"] #dashboardSidebar.show {
    transform: translateX(0);
    box-shadow: 10px 0 35px rgba(0,0,0,.35);
  }
  html[dir="ltr"] body[data-notification-role="admin"] .dashboard-layout,
  html[dir="ltr"] body[data-notification-role="patient"] .dashboard-layout {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  html[dir="ltr"] body[data-notification-role="admin"] .admin-topbar,
  html[dir="ltr"] body[data-notification-role="patient"] .admin-topbar {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
  }
  html[dir="ltr"] body[data-notification-role="admin"] .clinic-preferences,
  html[dir="ltr"] body[data-notification-role="patient"] .clinic-preferences {
    left: 12px !important;
    right: auto !important;
  }
  html[dir="ltr"] body[data-notification-role="admin"] #mobileSidebarClose,
  html[dir="ltr"] body[data-notification-role="patient"] #mobileSidebarClose {
    left: auto !important;
    right: 12px !important;
  }
}

/* أزرار إجراءات المريض: عمودية ومرتبة في العربية والإنجليزية */
.patient-actions { display: flex; flex-direction: column; gap: 6px; min-width: 104px; align-items: stretch; }
.patient-actions .btn { width: 100%; white-space: nowrap; text-align: start; display: flex; align-items: center; justify-content: flex-start; }
html[dir="ltr"] .patient-actions .btn { direction: ltr; }
td:has(> .patient-actions) { vertical-align: middle; }
