html {
  font-size: 14px;
  direction: rtl;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Multi-level page menu (Bootstrap has no built-in support for this). Top-level items open
   their dropdown on hover — like the level-2+ submenus — instead of via Bootstrap's JS
   click-toggle, so a click on the link itself still navigates to that page. */
.navbar-nav .nav-item.dropdown:hover > .dropdown-menu {
  display: block;
}

.dropdown-submenu {
  position: relative;
}

.dropdown-submenu > .dropdown-menu {
  top: 0;
  right: 100%;
  margin-top: -1px;
}

.dropdown-submenu > a::after {
}

.nav-item > .dropdown-toggle::after {
    margin-right: 3px;
}

.dropdown-submenu > .dropdown-toggle::after {
  display: inline-block;
  vertical-align: 0.1em;
    border-top: 0.3em solid transparent;
    border-right: 0.3em solid;
    border-bottom: 0.3em solid transparent;
    margin-right: 5px;
}


.dropdown-submenu.show > .dropdown-menu,
.dropdown-submenu:hover > .dropdown-menu {
  display: block;
}

/* Hover background on top navbar items (both plain links and dropdown toggles). */
.navbar-nav > .nav-item > .nav-link:hover {
  background-color: rgba(0, 0, 0, 0.07);
  border-radius: 5px;
}

.dropdown-item {
    text-align: right;
}

.dropdown-item:hover {
    text-align: right;
    background-color: rgba(0, 0, 0, 0.07);
}

.dropdown-item:active{
    color: rgb(33, 37, 41);
}

/* ---- Timetable module (ported from the legacy IS.TimeTable module.css) ---- */

.tt-module .TTTable {
  width: 100%;
  table-layout: fixed;
  border: solid 1px #777777;
  border-collapse: collapse;
}

.tt-module .TTCell {
  font-size: 12px;
  background-color: #ffffee;
  overflow: hidden;
  border: solid 1px #777777;
  vertical-align: top;
}

.tt-module .TTLesson {
  font-size: 12px;
  padding: 2px;
  color: #525252;
  text-align: right;
}

.tt-module .TTChange {
  font-weight: bold;
  font-size: 12px;
  padding: 2px;
  text-align: right;
}

.tt-module .CTitle {
  font-size: 14px;
  font-weight: bold;
  color: #527752;
  text-align: center;
  border: solid 1px #777777;
  padding: 2px;
}

.tt-module .CName {
  font-size: 12px;
  color: #333333;
  text-align: center;
  border: solid 1px #777777;
  vertical-align: middle;
}

.tt-module .Holiday {
  color: #fe7070;
  font-weight: bold;
  white-space: nowrap;
}

.tt-module .hour-time {
  color: #656565;
  font-size: 0.9em;
  font-weight: normal;
}

.tt-module .teach-type {
  color: #cb0000;
  font-weight: bold;
}

.tt-module .teach-type-a {
  color: #c98700;
  font-weight: bold;
}

.tt-module .teach-note {
  color: #808080;
  font-weight: bold;
  font-style: italic;
}

.tt-module .remote-lesson-link {
  font-weight: bold;
  color: blue;
}

/* In-cell change highlight colors, matching the legacy kiosk/table palette. */
.tt-module .TableFreeChange {
  color: #ffffff;
  background-color: red;
}

.tt-module .TableRemoteChange {
  color: #ffffff;
  background-color: orange;
}

.tt-module .TableFillChange {
  color: #000000;
  background-color: lime;
}

.tt-module .TableExamChange {
  color: #000000;
  background-color: yellow;
}

.tt-module .TableEventChange {
  color: #000000;
  background-color: silver;
}

.tt-module .tt-changes-list li {
  padding-bottom: 7px;
}

.tt-module .ChangesInfo {
  font-size: 13px;
  color: #527752;
}

.tt-module .ChangesDate {
  font-size: 13px;
  color: #777777;
}

/* Teacher-view TZ prompt — a native <dialog> (no Bootstrap JS on the embeddable page). */
.tt-tz-dialog {
  border: 1px solid #ced4da;
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  width: min(22rem, 90vw);
}

.tt-tz-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.tt-module .MsgCell {
  font-size: 14px;
  color: #333333;
}

.tt-module .EmptyList {
  text-align: center;
  font-size: 17px;
  font-weight: bold;
  color: #337733;
}

.tt-module .UpdateDate {
  font-size: 9px;
  font-weight: bold;
  color: #777777;
  text-align: left;
  padding-top: 10px;
}

/* Mobile single-day view: timetable.js inserts .tt-day-nav and marks the visible day's
   cells with .tt-day-active; both only take effect under the mobile media query below,
   so the desktop week grid (and the no-JS mobile fallback) is untouched. */
.tt-module .tt-day-nav {
  display: none;
}

@media (max-width: 767.98px) {
  .tt-module .tt-day-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .tt-module .tt-day-nav-title {
    font-size: 14px;
    font-weight: bold;
    color: #527752;
    text-align: center;
  }

  .tt-module .TTTable.tt-single-day td[data-day]:not(.tt-day-active) {
    display: none;
  }

  /* The nav title already shows the active day's header — drop the header row. */
  .tt-module .TTTable.tt-single-day tr:first-child {
    display: none;
  }
}

/* Teacher-view month calendar (ported shf-cal styles), shared with the Events module. */
.tt-module .shf-cal-header-month,
.events-module .shf-cal-header-month {
  font-size: 18px;
  font-weight: bold;
}

.tt-module .shf-cal-table,
.events-module .shf-cal-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.tt-module .shf-cal-table td,
.events-module .shf-cal-table td {
  border: 1px solid #afafaf;
  vertical-align: top;
}

.tt-module .shf-cal-day-title,
.events-module .shf-cal-day-title {
  font-size: 16px;
  color: #555555;
  padding: 3px 3px 1px 3px;
}

.tt-module .shf-cal-day-header-holiday,
.events-module .shf-cal-day-header-holiday {
  background-color: #ffe7a9;
}

.tt-module .shf-cal-day-content,
.events-module .shf-cal-day-content {
  height: 120px;
  overflow: hidden;
}

.tt-module .nextprev-month,
.events-module .nextprev-month {
  color: #c7c7c7;
}

.tt-module .shf-cal-entry,
.events-module .shf-cal-entry {
  font-size: 12px;
  padding: 2px 4px 2px 1px;
  margin: 1px 2px;
  cursor: default;
  border-radius: 3px;
}

.tt-module .cal-event,
.events-module .cal-event {
  color: #ffffff;
  background-color: #0073b7;
}

.tt-module .cal-exam,
.events-module .cal-exam {
  color: #ffffff;
  background-color: #00a65a;
}

/* ---- Events module (month calendar of school events + timetable data + .ics feeds) ---- */

.events-module .shf-cal-dow {
  border: 1px solid #afafaf;
  background-color: #f2f2f2;
  font-size: 13px;
  font-weight: 600;
  color: #555555;
  text-align: center;
  padding: 3px;
}

.events-module .shf-cal-today .shf-cal-day-title {
  background-color: #d9edf7;
  font-weight: bold;
}

/* admin-entered school events */
.events-module .cal-school {
  color: #ffffff;
  background-color: #8e44ad;
}

/* external .ics feed entries */
.events-module .cal-ics {
  color: #ffffff;
  background-color: #d9534f;
}

.events-module .cal-entry-time {
  font-size: 11px;
  opacity: 0.85;
  margin-inline-end: 4px;
}

.events-module .cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 13px;
  color: #555555;
}

.events-module .cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.events-module .cal-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* ---- StaticText module ----
   Rendered output of StaticTextRenderer.cs; the class names are part of the markup
   round-trip (statictext-editor.js), so keep colors/sizes in sync with both. */

.st-content {
  overflow-wrap: break-word;
}

.st-content::after {
  /* contain floated images */
  content: "";
  display: block;
  clear: both;
}

.st-content p {
  margin-bottom: 0.5rem;
}

.st-c-red    { color: #c0392b; }
.st-c-orange { color: #d35400; }
.st-c-yellow { color: #b7950b; }
.st-c-green  { color: #1e8449; }
.st-c-teal   { color: #148f77; }
.st-c-blue   { color: #1f618d; }
.st-c-purple { color: #7d3c98; }
.st-c-gray   { color: #707b7c; }

.st-s-xs  { font-size: 0.75rem; }
.st-s-sm  { font-size: 0.875rem; }
.st-s-lg  { font-size: 1.25rem; }
.st-s-xl  { font-size: 1.5rem; }
.st-s-xxl { font-size: 2rem; }

.st-img {
  max-width: 100%;
  height: auto;
}

.st-align-left {
  float: left;
  margin: 0.25rem 1rem 0.5rem 0;
}

.st-align-right {
  float: right;
  margin: 0.25rem 0 0.5rem 1rem;
}

.st-align-center {
  display: block;
  float: none;
  margin: 0.5rem auto;
}

/* ---- StaticText admin editor (ModuleEdit.cshtml + statictext-editor.js) ---- */

.st-toolbar {
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.st-editor {
  min-height: 240px;
  max-height: 640px;
  overflow-y: auto;
}

.st-colors {
  min-width: 0;
  width: 9.5rem;
}

.st-swatch {
  width: 1.5rem;
  height: 1.5rem;
  margin: 0.1rem;
  padding: 0;
  border: 1px solid #adb5bd;
  border-radius: 0.25rem;
  display: inline-block;
  vertical-align: middle;
}

.st-imgbar {
  position: absolute;
  z-index: 100;
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.st-editor img.st-selected {
  outline: 2px solid #0d6efd;
  outline-offset: 1px;
}

/* ---- Files module admin upload (ModuleEdit.cshtml + files-admin.js) ---- */

.files-dropzone {
  border: 2px dashed #ced4da;
  border-radius: 0.5rem;
  padding: 1rem;
  text-align: center;
  color: #6c757d;
  background: #f8f9fa;
}

.files-dropzone.files-dragover {
  border-color: #0d6efd;
  background: #e7f1ff;
  color: #0d6efd;
}

.files-dropzone.files-uploading {
  opacity: 0.6;
  pointer-events: none;
}

.st-resize-handle {
  position: absolute;
  z-index: 101;
  width: 14px;
  height: 14px;
  background: #0d6efd;
  border: 2px solid #fff;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  cursor: nwse-resize;
  touch-action: none; /* keep pointer events during touch drags */
}


.page-tree-scroll {
    overflow-x: auto;
}

ul.tree {
    /* room on the right (RTL start side) for the connector lines */
    padding: 0 1.5rem 0 0;
}

.tree ul {
    margin: 0;
    /* one level of indentation, start side only — the left edge stays put so
       .page-tree-row columns align across depths */
    padding: 0 1.5rem 0 0;
    position: relative;
}

.tree li {
    list-style: none;
    position: relative;
}

/* One page row: the 1fr title column absorbs the tree indentation, so the
   fixed-width info columns and the (identical-content) controls column line
   up across all depths. Order is RTL: title is the rightmost column. */
.page-tree-row {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) 5rem 5rem 27rem max-content;
    column-gap: 0.5rem;
    align-items: center;
}

.page-tree-row:hover
{
    background-color: #f5f5f5;
}

.page-tree-row > * {
    min-width: 0; /* let text-truncate cells actually shrink */
    margin-top: 5px;
    margin-bottom: 5px;
}

.tree li::before {
    content: "";
    position: absolute;
    right: -1.0rem;
    top: 0.0rem;
    bottom: -1.3rem;
    width: 1px;
    background: #adb5bd;
}

.tree li::after {
    content: "";
    position: absolute;
    right: -1.0rem;
    top: 1.3rem;
    width: 0.9rem;
    height: 1px;
    background: #adb5bd;
}

/* Last child */
.tree li:last-child::before {
    bottom: calc(100% - 1.3rem);
}

/* ---- Staff module (cards grid + admin photo editor) ---- */

.staff-module .staff-photo {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  padding: 35px;
  border-radius: 500px;
}

.staff-module .staff-bio {
  white-space: pre-line; /* Bio is plain text; keep the author's line breaks */
}

/* Generic admin image drop zone (image-dropzone.js: staff photo, school logo) */
.img-dropzone {
  border: 2px dashed #ced4da;
  border-radius: 0.5rem;
  padding: 1rem;
  text-align: center;
  color: #6c757d;
  background: #f8f9fa;
  cursor: pointer;
}

.img-dropzone.img-dragover {
  border-color: #0d6efd;
  background: #e7f1ff;
  color: #0d6efd;
}

.staff-photo-preview {
  max-width: 200px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 0.5rem;
}

/* ---- School details (header logo + footer contact block) ---- */

.school-logo {
  max-height: 2.5rem;
  width: auto;
}

.logo-preview {
  max-height: 5rem;
  max-width: 100%;
  width: auto;
}

/* ---- Gallery module (tiles grid + fullscreen lightbox, gallery.js) ---- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.5rem;
}

.gallery-grid a {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 0.375rem;
  background: #f0f1f3;
}

.gallery-grid img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.15s ease-in-out;
}

.gallery-grid a:hover img,
.gallery-grid a:focus-visible img {
  transform: scale(1.05);
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1080; /* above Bootstrap's fixed elements */
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
}

.gallery-lightbox.open {
  display: flex;
}

body.gallery-lightbox-open {
  overflow: hidden;
}

.gallery-lightbox img {
  max-width: 94vw;
  max-height: 94vh;
  object-fit: contain;
}

.gallery-lightbox button {
  position: absolute;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 3rem;
  line-height: 1;
  padding: 0.5rem 1rem;
  cursor: pointer;
  opacity: 0.75;
  user-select: none;
}

.gallery-lightbox button:hover {
  opacity: 1;
}

/* physical (not RTL-flipped) positions, like most lightboxes on RTL sites */
.gallery-lb-close {
  top: 0.5rem;
  right: 1rem;
  font-size: 2.5rem;
}

.gallery-lb-prev {
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.gallery-lb-next {
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.gallery-lb-counter {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  opacity: 0.8;
}

/* admin image list on ModuleEdit */
.gallery-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: 0.75rem;
}

.gallery-admin-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 0.375rem;
}

.force-ltr {
    direction: ltr;
}

.screen-frame {
    display: block;
    width: 42%;
    aspect-ratio: 16 / 9;
    border: 0;
    zoom: 42%;
    float: left;
    padding: 30px;
}

.screen-details {
    padding: 10px;
    float: right;
}

.slug {
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    padding: 4px;
    margin-left: 10px;
    font-weight: bold;
}

.slug-host {
    background-color: #f0f0f0;
}