/* Keep box-sizing consistent without redefining html/body twice */
*, *::before, *::after {
  box-sizing: border-box;
}

html[dir="rtl"] .container { direction: rtl; }
html[dir="ltr"] .container { direction: ltr; }

/* Headings color (grouped) */
h3,
h4 {
  color: #00254e !important;
}

h5 {
  color: #000 !important;
}

/* =========================================================
   1) Shared layout helpers
   ========================================================= */

.about-div {
  display: none;
}

.about-p,
.about-p p,
.about-p ul,
.about-p li {
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
}

.about-p {
  padding-right: 2em !important;
  padding-left: 2em !important;
}

.about-p ul {
  padding-right: 1.5rem;
  padding-left: 0;
}

/* =========================================================
   2) Accordion (old one — if you still use it)
   ========================================================= */

.accordion a {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 1rem 3rem 1rem 1rem;
  color: #7288a2;
  border-bottom: 1px solid #e5e5e5;
  position: relative;
}

.accordion a:hover,
.accordion a:hover::after {
  cursor: pointer;
  color: #364996;
}

.accordion a:hover::after {
  border-color: #364996;
}

.accordion a.active {
  color: #364996;
  border-bottom-color: #364996;
}

.accordion a::after {
  content: "\25BD";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #7288a2;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #7288a2;
  text-align: center;
  line-height: 28px;
}

.accordion a.active::after {
  content: "\25C0";
  color: #364996;
  border-color: #364996;
}

.accordion .content {
  opacity: 0;
  padding: 0 1rem;
  max-height: 0;
  border-bottom: 1px solid #e5e5e5;
  overflow: hidden;
  transition: all 0.2s ease 0.15s;
}

.accordion .content.active {
  opacity: 1;
  padding: 1rem;
  max-height: 100%;
  transition: all 0.35s ease 0.15s;
}

/* =========================================================
   3) Title pill (h1.text-divider)
   ========================================================= */

h1.text-divider {
  margin: 28px 0 35px;
  line-height: 1.6;
  text-align: right;
  color: #00254e !important;
  font-size: 3.5vh; /* keep once */
}

h1.text-divider::before {
  content: none;
}

h1.text-divider.shown {
  border: none;
}

h1.text-divider span {
  display: inline-block;
  padding: 14px 34px;
  background: #00254e;
  color: #fff !important;
  border-radius: 999px;
  font-size: 1.7rem;
  font-weight: 800;
  position: relative;
  box-shadow: 0 6px 20px rgba(0, 37, 78, 0.20);
  letter-spacing: 0.5px;
}

h1.text-divider span::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 999px;
  border: 2px solid rgba(212, 160, 23, 0.6);
  pointer-events: none;
}

/* h2 divider (keep if still used anywhere) */
h2.text-divider {
  color: #000 !important;
  text-align: right;
  font-size: 3vh;
  word-break: break-word;
}

h2.text-divider::before {
  content: "";
  display: block;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
}

/* =========================================================
   4) Tabs (same as departments)
   ========================================================= */

.tab {
  direction: rtl;
  width: 100%;
  margin-top: 12px;
}

.tab .nav-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  border-bottom: 1px solid #e3e6ec;
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.tab .nav-tabs li {
  float: none;
  margin: 0 0 6px 6px;
}

.tab .nav-tabs li a {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 8px;
  background: #fafbff;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #3e4a63;
  border-radius: 8px;
  border: 1px solid #e3e6ec;
  transition: all 0.2s ease;
  position: relative;
}

.tab .nav-tabs li a span {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #eef1f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #00254e;
  font-size: 14px;
}

.tab .nav-tabs li a:hover {
  background: #f0f3f9;
  border-color: #c9ccd6;
  color: #00254e;
}

.tab .nav-tabs li.active a {
  background: #00254e;
  color: #fff;
  border-color: #00254e;
  box-shadow: 0 4px 12px rgba(0, 37, 78, 0.20);
}

.tab .nav-tabs li.active a span {
  background: #d4a017;
  color: #00254e;
}

.tab .nav-tabs li.active a::after {
  content: "";
  position: absolute;
  bottom: -6px;
  right: 10px;
  left: 10px;
  height: 3px;
  background: #d4a017;
  border-radius: 2px;
}

.tab .tab-content {
  padding: 15px 5px 5px;
  margin-top: 8px;
  font-size: 15px;
  color: #000;
  line-height: 1.8;
}

/* keep all tabs in one row on desktop */
@media (min-width: 992px) {
  .tab .nav-tabs {
    flex-wrap: nowrap;
  }

  .tab .nav-tabs li a {
    padding: 8px 14px;
    font-size: 13px;
  }
}

/* =========================================================
   5) Sidebar (Gold bar nav) — CLEAN + no duplicate blocks
   ========================================================= */

#sidebar {
  z-index: 1;
  width: 100%;
  max-width: 260px;
  margin-top: 25px;
}

#sidebar,
#sidebar .side,
#sidebar .list-group-item {
  direction: rtl;
  text-align: right;
}

#sidebar .side {
  background: #fff;
  border: 1px solid #e3e6ec;
  border-radius: 10px;
  padding: 10px 0;
  box-shadow: 0 4px 14px rgba(0, 37, 78, 0.06);
  position: sticky;
  top: 120px;
}

#sidebar .list-group {
  margin-bottom: 0;
}

#sidebar .list-group-item {
  position: relative;
  border: none !important;
  background: transparent;
  border-radius: 0;
  padding: 10px 18px 10px 10px;
  margin: 2px 0;
  font-size: 14px;
  color: #3e4a63;
  transition: background 0.15s ease, padding-right 0.15s ease, color 0.15s ease;
}

#sidebar .list-group-item::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: #d4a017;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#sidebar .list-group-item:hover::before {
  opacity: 0.3;
}

#sidebar .list-group-item.active::before {
  opacity: 1;
}

#sidebar .list-group-item:hover,
#sidebar .list-group-item.active,
#sidebar .list-group-item.active:hover {
  background: #f5f7fb !important;
  color: #00254e !important;
  padding-right: 22px !important;
}

#sidebar .list-group-item.active {
  border-color: transparent !important;
}

#sidebar .list-group-item.list-sub {
  padding-right: 30px;
  font-size: 13px;
  background: rgba(134, 185, 243, 0.08);
}

/* kill Bootstrap "active background navy" conflict (optional) */
.list-group-item.active {
  background-color: #f5f7fb !important;
}

/* =========================================================
   6) Sonar (contact pulse)
   ========================================================= */

.sonar-wrapper {
  position: relative;
  overflow: visible !important;
  padding: 3rem 0 2rem 0;
}

.sonar-emitter {
  position: relative;
  width: 27px;
  height: 27px;
  border-radius: 9999px;
  background-color: hsl(228, 38%, 26%);
}

.sonar-wave {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background-color: hsl(228, 38%, 26%);
  opacity: 0;
  z-index: -1;
  animation: sonarWave 2s linear infinite;
}

@keyframes sonarWave {
  from {
    opacity: 0.4;
  }

  to {
    transform: scale(3);
    opacity: 0;
  }
}

/* =========================================================
   7) Profile Boxes (base)
   ========================================================= */

.box9 {
  text-align: center;
  position: relative;
  width: 250px;
  height: 250px;
}

.box9 img {
  width: 250px;
  height: 250px;
}

@media (max-width: 990px) {
  .box9 {
    margin-bottom: 20px;
  }
}

/* =========================================================
   7.5) ✅ Director card image FIX (THIS IS THE IMPORTANT PART)
   prevents placeholder image from breaking layout
   ========================================================= */

.director-card {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap; /* safe on small screens */
}

.director-card-photo {
  width: 140px;
  height: 140px; /* fixed frame */
  border-radius: 16px;
  overflow: hidden;
  background: #f4f6fb;
  border: 1px solid #dde2ec;
  flex: 0 0 auto;
}

.director-card-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover; /* key: stable regardless of placeholder size */
}

.director-card-body {
  flex: 1 1 260px;
  min-width: 260px;
}

/* =========================================================
   8) Teachers / Cards
   ========================================================= */

.teachers-wrapper {
  direction: rtl;
  text-align: right;
}

.teacher-card {
  background: #fff;
  border-radius: 18px;
  border: 1px solid #dde2ec;
  box-shadow: 0 10px 28px rgba(0, 37, 78, 0.08);
  padding: 18px 18px 14px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background-color 0.22s ease;
  height: 500px;
}

.teacher-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(0, 37, 78, 0.18);
  border-color: #d4a017;
  background: #fbfbff;
}

.teachers-wrapper .box9 {
  width: 100% !important;
  height: 240px !important;
  margin: 0 auto 14px;
}

.teachers-wrapper .box9 img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  border-radius: 14px;
  background: #f4f6fb;
  padding: 8px;
  display: block;
}

.teacher-body {
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.teacher-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #00254e;
  margin-bottom: 4px;
}

.teacher-degree {
  font-size: 0.98rem;
  color: #555;
  margin-bottom: 4px;
}

.teacher-meta {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 8px;
}

.teacher-email {
  margin-bottom: 10px;
  font-size: 0.9rem;
  min-height: 22px;
  display: flex;
  align-items: center;
}

.teacher-actions {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  gap: 6px;
}

.teacher-actions li {
  display: inline-block;
  margin: 0;
}

.teacher-cv-slot {
  min-width: 135px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.9rem;
}

.teacher-profile-btn {
  min-width: 135px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .teacher-card {
    height: auto;
    padding: 14px 14px 10px;
  }

  .teachers-wrapper .box9 {
    height: 200px !important;
  }

  .teacher-name {
    font-size: 1.1rem;
  }

  .teacher-degree,
  .teacher-meta {
    font-size: 0.9rem;
  }
}

/* =========================================================
   9) Responsive (grouped — no repetition)
   ========================================================= */

@media (max-width: 768px) {
  #sidebar {
    max-width: 100%;
  }

  #sidebar .side {
    position: static;
    top: auto;
  }

  h1.text-divider {
    text-align: center;
    margin: 20px 0 25px;
    font-size: 2.5vh;
  }

  h1.text-divider span {
    font-size: 1.35rem;
    padding: 10px 26px;
  }

  h2.text-divider {
    font-size: 2.5vh;
  }
}

.sidebar-offcanvas.active {
  display: block;
  position: fixed;
  z-index: 99999 !important;
}

/* Small phones */
@media (max-width: 480px) {
  h1.text-divider {
    font-size: 2.5vh;
  }

  h2.text-divider {
    font-size: 2.5vh;
  }
}

/* =========================================================
   PATCH: Courses (Section2) + Attachments (Section5) ONLY
   Paste at the VERY END of department.css
   ========================================================= */

/* ---------- Shared: nicer blocks inside tab panes ---------- */
.tab-pane {
  text-align: right;
}

/* =========================================================
   A) COURSES TAB (Section2)
   Targets: .grad-req-box, .btn-grad-plan, .table-courses, .course-table-wrapper
   ========================================================= */

/* Graduation requirement box */
.grad-req-box {
  background: #fff;
  border: 1px solid #dde2ec;
  border-radius: 14px;
  padding: 18px 18px;
  box-shadow: 0 8px 22px rgba(0, 37, 78, 0.07);
  margin: 10px 0 14px;
}

.grad-req-box h3 {
  margin: 0 0 10px 0;
  font-weight: 800;
  color: #00254e !important;
  font-size: 1.1rem;
}

.grad-req-number {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0, 37, 78, 0.08);
  color: #00254e;
  font-weight: 900;
  margin-bottom: 10px;
}

.grad-req-details {
  color: #556277;
  line-height: 1.9;
  font-size: 0.95rem;
}

/* Download study plan button */
.btn-grad-plan {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  background: #00254e;
  color: #fff !important;
  border: 1px solid #00254e;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
  box-shadow: 0 10px 26px rgba(0, 37, 78, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  margin: 6px 0 16px;
}

.btn-grad-plan:hover {
  transform: translateY(-2px);
  filter: brightness(1.02);
  box-shadow: 0 16px 34px rgba(0, 37, 78, 0.22);
}

/* Wrapper spacing */
.course-table-wrapper {
  margin-top: 10px;
}

/* Table container: make it feel like a card */
.course-table-wrapper .table-responsive {
  background: #fff;
  border: 1px solid #dde2ec;
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(0, 37, 78, 0.07);
  padding: 8px;
}

/* Courses table styling */
.table-courses {
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.table-courses thead th {
  background: #f7f9fc;
  color: #00254e;
  font-weight: 900;
  font-size: 0.92rem;
  border-bottom: 1px solid #dde2ec !important;
  padding: 12px 10px !important;
  white-space: nowrap;
}

.table-courses tbody td {
  padding: 12px 10px !important;
  border-top: 1px solid #eef1f6 !important;
  color: #24324a;
  vertical-align: middle !important;
}

.table-courses tbody tr:hover {
  background: rgba(212, 160, 23, 0.08);
}

/* Fix: unit cell looks cramped sometimes */
.table-courses .unit-cell {
  font-weight: 800;
  color: #00254e;
}

/* "PDF" link inside table */
.table-courses a.text-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 37, 78, 0.08);
  color: #00254e !important;
  font-weight: 800;
  transition: background 0.15s ease, transform 0.15s ease;
}

.table-courses a.text-primary:hover {
  background: rgba(212, 160, 23, 0.18);
  transform: translateY(-1px);
}

.table-courses .text-muted {
  color: #7a869a !important;
  font-weight: 700;
}

/* Mobile: keep table readable */
@media (max-width: 768px) {
  .course-table-wrapper .table-responsive {
    padding: 0;
    border-radius: 12px;
  }

  .table-courses thead th,
  .table-courses tbody td {
    font-size: 0.9rem;
    padding: 10px 8px !important;
  }
}

/* =========================================================
   B) ATTACHMENTS TAB (Section5)
   Targets: .attachments-wrapper, .attachments-table, .attachment-link
   ========================================================= */

.attachments-wrapper {
  background: #fff;
  border: 1px solid #dde2ec;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 10px 26px rgba(0, 37, 78, 0.07);
  margin-top: 10px;
}

.attachments-title {
  margin: 0 0 12px 0;
  color: #00254e !important;
  font-weight: 900;
  font-size: 1.15rem;
}

.attachments-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid #dde2ec;
  border-radius: 14px;
  background: #fff;
}

.attachments-table thead th {
  background: #f7f9fc;
  color: #00254e;
  font-weight: 900;
  padding: 12px 10px;
  border-bottom: 1px solid #dde2ec;
  white-space: nowrap;
}

.attachments-table tbody td {
  padding: 12px 10px;
  border-top: 1px solid #eef1f6;
  color: #24324a;
}

.attachments-table tbody tr:hover {
  background: rgba(212, 160, 23, 0.08);
}

/* Attachment name */
.attachment-name {
  font-weight: 800;
}

/* Action link: consistent pill button */
.attachment-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 8px 12px;
  border-radius: 999px;
  background: #00254e;
  color: #fff !important;
  font-weight: 900;
  border: 1px solid #00254e;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  min-width: 140px;
}

.attachment-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(0, 37, 78, 0.18);
  filter: brightness(1.02);
}

.attachment-link i {
  font-size: 14px;
}

/* Missing */
.attachment-missing {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.10);
  color: #475569;
  font-weight: 800;
}

/* Make attachments table scroll nicely on small screens */
@media (max-width: 768px) {
  .attachments-wrapper {
    padding: 12px;
  }

  .attachment-link {
    min-width: 120px;
    padding: 8px 10px;
    font-size: 0.92rem;
  }

  .attachments-table thead th,
  .attachments-table tbody td {
    font-size: 0.92rem;
    padding: 10px 8px;
  }
}

/* =========================
   EN LTR OVERRIDES (because shared CSS has RTL rules)
   Keep this at the END so it wins
   ========================= */

html[dir="ltr"],
body[dir="ltr"] {
  direction: ltr !important;
  text-align: left;
}

/* If some file forces RTL on .container (common in your project), neutralize it */
body[dir="ltr"] .container,
body[dir="ltr"] .row,
body[dir="ltr"] #about-show,
body[dir="ltr"] .about-text,
body[dir="ltr"] .about-section-block {
  direction: ltr !important;
  text-align: left !important;
}

/* Fix padding/margins that might be written as RTL-only */
body[dir="ltr"] .about-text ul {
  padding-left: 1.5rem !important;
  padding-right: 0 !important;
}

/* Dean layout should feel natural in English */
body[dir="ltr"] .dean-wrap {
  flex-direction: row !important;
}

/* If any component uses unicode-bidi hacks for RTL, neutralize */
body[dir="ltr"] .about-p,
body[dir="ltr"] .about-p p,
body[dir="ltr"] .about-p li {
  unicode-bidi: normal !important;
}

/* EN ABOUT: force tabs to behave LTR */
html[dir="ltr"] .about-topnav .nav-tabs {
  direction: ltr !important;
  unicode-bidi: plaintext;
  justify-content: flex-start !important;
}

html[dir="ltr"] .about-topnav .nav-tabs > li {
  float: none !important; /* kills Bootstrap/RTL float rules */
}

html[dir="ltr"] .about-topnav .nav-tabs > li > a {
  direction: ltr !important;
  text-align: left !important;
}

/* EN ABOUT: icon must be on the LEFT of text */
html[dir="ltr"] .about-topnav .nav-tabs > li > a.about-nav-link {
  direction: ltr !important;
  unicode-bidi: plaintext;
  display: flex !important;
  flex-direction: row !important;
  justify-content: flex-start !important;
  text-align: left !important;
}

html[dir="ltr"] .about-topnav .nav-tabs > li > a.about-nav-link > span {
  order: 0 !important;
  margin-right: 8px !important;
  margin-left: 0 !important;
}

html[dir="ltr"] .about-topnav .nav-tabs > li > a.about-nav-link > span i {
  margin: 0 !important;
}

/* =========================
   EN LTR FIXES — department
   keep at the END
   ========================= */

html[dir="ltr"] .tab{ direction:ltr !important; }

html[dir="ltr"] .tab .nav-tabs{
  direction:ltr !important;
  justify-content:flex-start !important;
}

html[dir="ltr"] .tab .nav-tabs li a{
  direction:ltr !important;
  text-align:left !important;
  display:flex !important;
  flex-direction:row !important; /* icon LEFT */
  align-items:center;
}

html[dir="ltr"] .tab .nav-tabs li a span{
  order:0 !important;
  margin-right:8px !important;
  margin-left:0 !important;
}

/* =========================
   EN LTR OVERRIDES — HARD RTL RESET
   keep at the END
   ========================= */

html[dir="ltr"] .about-p,
html[dir="ltr"] .about-p p,
html[dir="ltr"] .about-p ul,
html[dir="ltr"] .about-p li{
  direction: ltr !important;
  text-align: left !important;
  unicode-bidi: normal !important;
}

html[dir="ltr"] h1.text-divider,
html[dir="ltr"] h2.text-divider{
  text-align: left !important;
}

html[dir="ltr"] .teachers-wrapper{
  direction: ltr !important;
  text-align: left !important;
}

html[dir="ltr"] #sidebar,
html[dir="ltr"] #sidebar .side,
html[dir="ltr"] #sidebar .list-group-item{
  direction: ltr !important;
  text-align: left !important;
}

html[dir="ltr"] .tab-pane{
  text-align: left !important;
}

/* Accordion arrow side */
html[dir="ltr"] .accordion a::after{
  right: auto !important;
  left: 1rem !important;
}