/* ==========================================================================
   UKuni Universities – front-end block  v1.2.0
   Scope: .uu-block (grid) + .uu-modal (dialog appended to <body>)
   ========================================================================== */

.uu-block,
.uu-modal {
  --uu-navy: #1b2a41;
  --uu-red: #d9232a;
  --uu-red-dark: #b81c22;
  --uu-text: #1b2a41;
  --uu-muted: #63707f;
  --uu-border: #e3e8ef;
  --uu-border-strong: #cfd7e2;
  --uu-bg: #f5f7fa;
  --uu-bg-active: #e6ebf2;
  --uu-white: #ffffff;
  --uu-font: 'Poppins', 'Segoe UI', sans-serif;
  --uu-radius: 12px;
  --uu-shadow: 0 10px 30px rgba(27, 42, 65, 0.12);
  --uu-focus: 0 0 0 3px rgba(217, 35, 42, 0.25);

  font-family: var(--uu-font);
  color: var(--uu-text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}

:where(.uu-block, .uu-modal) * {
  box-sizing: border-box;
}

/* Safety net: never let the block run edge-to-edge in a full-width section.
   Inside a boxed container (≤ 1200px) this has no visible effect. */
.uu-block {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 1240px) {
  .uu-block {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Arabic pages: Cairo for the UI; English names / programme titles stay in Poppins */
.uu-block[dir="rtl"],
.uu-modal[dir="rtl"] {
  --uu-font-ar: 'Cairo', 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  font-family: var(--uu-font-ar);
}

.uu-block[dir="rtl"] .is-en,
.uu-modal[dir="rtl"] .is-en,
.uu-modal[dir="rtl"] .uu-progs li {
  font-family: var(--uu-font);
}

/* zero-specificity reset so component classes win over it */
:where(.uu-block, .uu-modal) button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}

.uu-block :focus-visible,
.uu-modal :focus-visible {
  outline: none;
  box-shadow: var(--uu-focus);
}

.uu-icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  vertical-align: -0.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.uu-hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Toolbar: country tabs + search
   -------------------------------------------------------------------------- */
.uu-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 0 0 22px;
}

.uu-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
  background: var(--uu-white);
  border: 1px solid var(--uu-border);
  border-radius: 12px;
  flex: 1 1 520px;
  min-width: 0;
  transition: opacity 0.15s;
}

.uu-tabs.is-muted {
  opacity: 0.45;
  pointer-events: none;
}

.uu-tab {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--uu-muted);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.uu-tab:hover {
  color: var(--uu-navy);
}

.uu-tab.is-active {
  background: var(--uu-bg-active);
  color: var(--uu-navy);
}

.uu-tab-count {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--uu-bg);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  color: var(--uu-muted);
  vertical-align: 1px;
}

.uu-tab.is-active .uu-tab-count {
  background: var(--uu-white);
  color: var(--uu-navy);
}

.uu-search {
  position: relative;
  flex: 0 1 300px;
  min-width: 220px;
}

.uu-search .uu-icon {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--uu-muted);
  pointer-events: none;
}

.uu-search input {
  width: 100%;
  height: 46px;
  margin: 0;
  padding: 0 14px;
  padding-inline-start: 42px;
  font: inherit;
  font-size: 14px;
  color: var(--uu-text);
  background: var(--uu-white);
  border: 1px solid var(--uu-border);
  border-radius: 12px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
}

.uu-search input::placeholder {
  color: #9aa5b1;
}

.uu-search input:focus {
  border-color: var(--uu-navy);
  box-shadow: none;
}

.uu-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.uu-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 24px;
}

.uu-dd {
  position: relative;
}

.uu-dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  background: var(--uu-white);
  border: 1px solid var(--uu-border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--uu-muted);
  transition: border-color 0.15s;
}

.uu-dd-btn:hover,
.uu-dd.is-open .uu-dd-btn,
.uu-dd.has-value .uu-dd-btn {
  border-color: var(--uu-navy);
}

.uu-dd-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(27, 42, 65, 0.15);
}

.uu-dd-value {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--uu-navy);
  white-space: nowrap;
}

.uu-dd-btn > .uu-icon {
  width: 14px;
  height: 14px;
  color: var(--uu-muted);
  transition: transform 0.15s;
}

.uu-dd.is-open .uu-dd-btn > .uu-icon {
  transform: rotate(180deg);
}

.uu-dd-list {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  z-index: 60;
  min-width: 100%;
  width: max-content;
  max-width: min(340px, 90vw);
  margin: 0 !important;
  padding: 6px !important;
  list-style: none !important;
  background: var(--uu-white);
  border: 1px solid var(--uu-border);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(27, 42, 65, 0.16);
  animation: uu-pop 0.14s ease-out;
}

.uu-dd-list[hidden] {
  display: none;
}

.uu-dd-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 !important;
  padding: 9px 12px !important;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--uu-text);
  cursor: pointer;
  outline: none;
}

.uu-dd-list li:hover,
.uu-dd-list li:focus {
  background: var(--uu-bg);
}

.uu-dd-list li .uu-icon {
  width: 15px;
  height: 15px;
  color: var(--uu-red);
  opacity: 0;
}

.uu-dd-list li[aria-selected="true"] {
  font-weight: 600;
  color: var(--uu-navy);
}

.uu-dd-list li[aria-selected="true"] .uu-icon {
  opacity: 1;
}

.uu-status {
  margin-inline-start: auto;
  font-size: 13px;
  color: var(--uu-muted);
}

/* --------------------------------------------------------------------------
   Sections (one per network) + card grid
   -------------------------------------------------------------------------- */
.uu-section {
  margin: 0 0 36px;
}

.uu-section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 18px;
  padding: 0 0 10px;
  border-bottom: 2px solid var(--uu-red);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--uu-navy);
}

.uu-section-logo {
  display: inline-flex;
  align-items: center;
  height: 34px;
}

.uu-section-logo img {
  display: block;
  max-height: 34px;
  max-width: 200px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.uu-section-title:has(.uu-section-logo) {
  align-items: center;
  padding-bottom: 12px;
}

.uu-count {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--uu-muted);
}

.uu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.uu-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 190px;
  padding: 26px 22px 22px;
  background: var(--uu-white);
  border: 1px solid var(--uu-border);
  border-radius: 14px;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.uu-card:hover {
  border-color: var(--uu-border-strong);
  box-shadow: var(--uu-shadow);
  transform: translateY(-2px);
}

.uu-card:focus-visible {
  border-color: var(--uu-red);
}

.uu-card-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 84px;
}

.uu-card-logo img {
  display: block;
  max-width: 170px;
  max-height: 84px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.uu-card-logo.is-missing {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--uu-bg);
  color: var(--uu-navy);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.uu-card-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--uu-navy);
}

.uu-card-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 8px;
  margin-top: auto;
  font-size: 12.5px;
  color: var(--uu-muted);
  white-space: nowrap;
}

.uu-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--uu-border-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--uu-navy);
  background: var(--uu-white);
  white-space: nowrap;
}

.uu-chip .uu-icon {
  width: 13px;
  height: 13px;
  color: var(--uu-red);
}

/* programme search: "N matching programmes" on the card */
.uu-card-meta .is-match {
  color: var(--uu-red);
  font-weight: 600;
}

.uu-empty {
  margin: 12px 0 0;
  padding: 36px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--uu-muted);
  background: var(--uu-white);
  border: 1px dashed var(--uu-border-strong);
  border-radius: 14px;
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
html.uu-lock {
  overflow: hidden;
}

/* Chat widgets (WhatsApp etc.) sit at very high z-indexes: the modal goes above them
   and they are hidden while it is open. */
html.uu-lock .wa__widget_container,
html.uu-lock #wa,
html.uu-lock .joinchat,
html.uu-lock .ht-ctc {
  visibility: hidden !important;
}

.uu-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.uu-modal[hidden] {
  display: none;
}

.uu-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  animation: uu-fade 0.18s ease-out;
}

.uu-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 800px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  background: var(--uu-white);
  border-radius: 18px;
  border-top: 4px solid var(--uu-red);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
  overflow: hidden;
  animation: uu-pop 0.2s ease-out;
}

.uu-close {
  position: absolute;
  top: 18px;
  inset-inline-end: 20px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--uu-border) !important;
  border-radius: 50%;
  background: var(--uu-white) !important;
  color: var(--uu-navy);
  transition: border-color 0.15s, background 0.15s;
}

.uu-close:hover {
  background: var(--uu-bg) !important;
  border-color: var(--uu-border-strong) !important;
}

.uu-close .uu-icon {
  width: 16px;
  height: 16px;
}

.uu-dialog-head {
  display: flex;
  flex: 0 0 auto;
  gap: 20px;
  align-items: flex-start;
  padding: 26px 76px 20px 28px;
  padding-inline-start: 28px;
  padding-inline-end: 76px;
}

.uu-dialog-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 78px;
  height: 78px;
  padding: 8px;
  background: var(--uu-bg);
  border: 1px solid var(--uu-border);
  border-radius: 14px;
  overflow: hidden;
}

.uu-dialog-logo img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.uu-dialog-logo.is-missing {
  font-size: 20px;
  font-weight: 700;
  color: var(--uu-navy);
}

.uu-dialog-info {
  flex: 1 1 auto;
  min-width: 0;
}

.uu-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.uu-dialog-title {
  margin: 0 0 4px;
  font-family: inherit;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--uu-navy);
}

.uu-dialog-sub {
  margin: 0;
  font-size: 14px;
  color: var(--uu-muted);
}

/* level pills + programme filter */
.uu-dialog-tools {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 12px;
  padding: 4px 28px 14px;
  border-bottom: 1px solid var(--uu-border);
}

.uu-levels {
  display: flex;
  flex: 1 1 320px;
  flex-wrap: wrap;
  min-width: 0;
  gap: 8px;
}

.uu-modal-filter {
  flex: 0 1 200px;
  min-width: 160px;
  margin-inline-start: auto;
}

.uu-modal-filter[hidden] {
  display: none;
}

.uu-modal-filter input {
  height: 36px;
  border-radius: 9px;
  font-size: 13px;
}

.uu-modal-filter .uu-icon {
  width: 16px;
  height: 16px;
  inset-inline-start: 11px;
}

.uu-modal-filter input {
  padding-inline-start: 34px;
}

.uu-level-count {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--uu-bg);
  font-size: 11px;
  line-height: 18px;
  color: var(--uu-muted);
}

.uu-level-tab.is-active .uu-level-count {
  background: rgba(255, 255, 255, 0.18);
  color: var(--uu-white);
}

.uu-nomatch {
  margin: 8px 0 0;
  padding: 32px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--uu-muted);
}

.uu-level-tab {
  flex: 0 0 auto;
  padding: 8px 13px;
  border: 1px solid var(--uu-border-strong) !important;
  border-radius: 9px;
  background: var(--uu-white) !important;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--uu-navy);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.uu-level-tab:hover {
  border-color: var(--uu-navy) !important;
}

.uu-level-tab.is-active {
  background: var(--uu-navy) !important;
  border-color: var(--uu-navy) !important;
  color: var(--uu-white);
}

/* body */
.uu-dialog-body {
  flex: 1 1 auto;
  min-height: 160px;
  padding: 20px 28px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.uu-related {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 0 0 20px;
  padding: 12px 16px;
  background: var(--uu-bg);
  border: 1px solid var(--uu-border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--uu-text);
}

.uu-related button {
  font-size: 13px;
  font-weight: 600;
  color: var(--uu-red);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.uu-level {
  margin: 0 0 26px;
}

.uu-level-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0 0 10px;
  border-bottom: 2px solid var(--uu-red);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--uu-navy);
}

.uu-level-title .uu-icon {
  width: 16px;
  height: 16px;
  color: var(--uu-red);
}

.uu-level-title .uu-count {
  margin-inline-start: auto;
}

.uu-modal .uu-progs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

/* programme names are English: keep them LTR even inside the Arabic (RTL) modal.
   !important on the box model protects against theme list resets. */
.uu-modal .uu-progs > li {
  direction: ltr;
  text-align: left;
  margin: 0 !important;
  padding: 11px 14px !important;
  list-style: none !important;
  background: var(--uu-white);
  border: 1px solid var(--uu-border);
  border-inline-start: 3px solid var(--uu-red);
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--uu-navy);
  overflow-wrap: anywhere;
}

.uu-loading,
.uu-error {
  padding: 40px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--uu-muted);
}

.uu-error {
  color: var(--uu-navy);
}

.uu-error button {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 16px;
  border: 1px solid var(--uu-navy) !important;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--uu-navy);
}

.uu-skeleton {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.uu-skeleton span {
  display: block;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f1f4f8 25%, #e6ebf2 50%, #f1f4f8 75%);
  background-size: 200% 100%;
  animation: uu-shimmer 1.2s linear infinite;
}

/* footer */
.uu-dialog-foot {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  padding: 16px 28px;
  border-top: 1px solid var(--uu-border);
  background: var(--uu-white);
}

.uu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  background: var(--uu-red);
  color: var(--uu-white) !important;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none !important;
  transition: background 0.15s, transform 0.15s;
}

.uu-btn:hover {
  background: var(--uu-red-dark);
  color: var(--uu-white);
}

.uu-btn .uu-icon {
  width: 16px;
  height: 16px;
}

[dir="rtl"] .uu-btn .uu-icon {
  transform: scaleX(-1);
}

/* --------------------------------------------------------------------------
   Motion + responsive
   -------------------------------------------------------------------------- */
@keyframes uu-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes uu-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes uu-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .uu-modal-backdrop,
  .uu-dialog,
  .uu-skeleton span {
    animation: none;
  }
  .uu-card:hover {
    transform: none;
  }
}

@media (max-width: 991px) {
  .uu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .uu-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .uu-search {
    flex: 1 1 100%;
  }
  .uu-grid {
    gap: 12px;
  }
  .uu-card {
    min-height: 0;
    padding: 18px 12px 16px;
    gap: 10px;
  }
  .uu-card-logo {
    height: 64px;
  }
  .uu-card-logo img {
    max-width: 120px;
    max-height: 64px;
  }
  .uu-card-name {
    font-size: 13px;
  }
  .uu-modal {
    padding: 0;
    align-items: flex-end;
  }
  .uu-dialog {
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 18px 18px 0 0;
  }
  .uu-dialog-head {
    gap: 14px;
    padding-top: 20px;
    padding-inline-start: 18px;
    padding-inline-end: 64px;
  }
  .uu-dialog-logo {
    width: 60px;
    height: 60px;
  }
  .uu-dialog-title {
    font-size: 19px;
  }
  .uu-dialog-tools {
    flex-wrap: wrap;
    padding-inline: 18px;
  }
  .uu-levels {
    flex: 1 1 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .uu-levels::-webkit-scrollbar {
    display: none;
  }
  .uu-modal-filter {
    flex: 1 1 100%;
  }
  .uu-filters {
    gap: 8px;
  }
  .uu-dd {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }
  .uu-dd-btn {
    width: 100%;
    justify-content: space-between;
  }
  .uu-dd-value {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .uu-modal-filter {
    flex: 1 1 100%;
    margin-inline-start: 0;
  }
  .uu-status {
    flex: 1 1 100%;
    margin-inline-start: 0;
  }
  .uu-dialog-body {
    padding: 16px 18px 20px;
  }
  .uu-modal .uu-progs,
  .uu-skeleton {
    grid-template-columns: 1fr;
  }
  .uu-dialog-foot {
    padding: 12px 18px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .uu-btn {
    width: 100%;
    justify-content: center;
  }
}
