/* =========================================================
   Signed-in pages — dashboard layout (templates/juDashboardTemplate.xhtml)
   Used by index.xhtml, userSelection.xhtml and changeUserAccount.xhtml.

   Follows the DGA platforms code (pfc) dashboard pattern, as in
   ju-room-booking: dark-green brand sidebar, white top bar card,
   breadcrumb, page title card (pfc-template-toolbar), white surfaces
   (pfc-template-surface) on the light-grey page, light footer line.
   Self-contained: the template does not load style.css, juStyle.css,
   searchable.css or the Bootstrap 4 / Font Awesome CDNs.
   Class prefix: db-
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }

html.db-html,
html.db-html body.db-body {
  margin: 0 !important;
  padding: 0 !important;
  min-height: 100vh;
  background: #f9fafb !important;
  color: #161616;
  font-family: 'IBM Plex Sans Arabic', sans-serif !important;
  font-size: 16px;
  line-height: 1.5;
}

/* ── Shell: sidebar + main column ───────────────────────── */
.db-shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

/* ── Sidebar (pfc-dashboard__sidebar--brand) ────────────── */
/* #sidebar only carries the open/closed class; its children join the shell row,
   so the sidebar can stay sticky against the whole page */
.db-sidebar-wrap { display: contents; }

.db-sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  width: 240px;
  height: 100vh;
  background: #074d31;
  color: #ffffff;
  overflow: hidden;
}
/* wide screens: the sidebar floats as a rounded card inside the page */
@media (min-width: 992px) {
  .db-sidebar {
    top: 12px;
    height: calc(100vh - 24px);
    margin-block: 12px;
    margin-inline-start: 12px;
    border-radius: 16px;
  }
}

.db-brand,
.db-brand:hover,
.db-brand:focus {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  text-decoration: none !important;
}
.db-brand:focus-visible { outline: 2px solid #ffffff; outline-offset: -2px; }
/* the logo has university colours on white, so it sits on a white chip */
.db-brand-chip {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  background: #ffffff;
}
.db-brand-chip img { display: block; width: 100%; height: 48px; object-fit: contain; }
.db-brand-name {
  color: #ffffff;
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
}

.db-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2px;
  min-height: 0;
  padding: 12px 8px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}
.db-nav-group { display: flex; flex-direction: column; gap: 2px; }

/* pfc-drawer__nav-item on the brand drawer */
.db-nav-item,
.db-nav-item:link,
.db-nav-item:visited {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 2px solid transparent;
  border-radius: 4px;
  color: #ffffff !important;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  text-decoration: none !important;
}
.db-nav-item:hover { background: rgba(255, 255, 255, 0.1); }
.db-nav-item:focus-visible { background: rgba(255, 255, 255, 0.12); outline: 2px solid #ffffff; outline-offset: 0; }
.db-nav-item:active { background: rgba(255, 255, 255, 0.2); }
.db-nav-item.db-active { background: rgba(255, 255, 255, 0.22); }
/* white marker on the inline-start edge of the current item */
.db-nav-item.db-active::after {
  content: '';
  position: absolute;
  top: 50%;
  inset-inline-start: 0;
  width: 6px;
  height: calc(100% - 12px);
  transform: translateY(-50%);
  border-radius: 9999px;
  background: #ffffff;
}
.db-nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; }
.db-nav-icon svg { width: 18px; height: 18px; }

.db-sidebar-footer {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 18px;
}

.db-backdrop { display: none; }

/* ── Main column ────────────────────────────────────────── */
.db-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  padding: 12px 24px 0;
}

/* ── Top bar ────────────────────────────────────────────── */
.db-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 8px 16px;
  background: #ffffff;
  border: 1px solid #d2d6db;
  border-radius: 16px;
}

/* icon-only buttons (pfc-btn--icon-only, lg = 40px) */
.db-icon-btn,
.db-icon-btn:link,
.db-icon-btn:visited {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #161616 !important;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.15s ease;
}
.db-icon-btn:hover { background: #f3f4f6; }
.db-icon-btn:active { background: #e5e7eb; }
.db-icon-btn:focus-visible { outline: 2px solid #161616; outline-offset: 0; }
.db-icon-btn svg { width: 20px; height: 20px; }
.db-icon-btn--secondary { background: #f3f4f6; }
.db-icon-btn--secondary:hover { background: #e5e7eb; }
.db-icon-btn--secondary:active { background: #d2d6db; }

.db-menu-btn { display: none; }

.db-spacer { flex: 1; }

/* Service search (filterSearchItem.js keys on .searchable, ul, li and .selected) */
.db-topbar .searchable {
  position: relative;
  float: none !important;
  flex: 0 1 380px;
  width: 100%;
  min-width: 0;
  margin: 0 !important;
}
.db-topbar .searchable input {
  display: block;
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 12px;
  padding-inline-start: 40px;
  border: 1px solid #9da4ae;
  border-radius: 4px;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c727e' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat;
  background-size: 20px 20px;
  background-position: right 12px center;
  color: #384250;
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-size: 15px;
  outline: none;
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
[dir="ltr"] .db-topbar .searchable input { background-position: left 12px center; }
.db-topbar .searchable input::placeholder { color: #6c727e; }
.db-topbar .searchable input:hover { border-color: #384250; }
.db-topbar .searchable input:focus { border-color: #384250; box-shadow: inset 0 -2px 0 #0c111b; }

.db-topbar .searchable ul {
  display: none;               /* opened and closed by filterSearchItem.js */
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1000;
  float: none;
  width: 100% !important;
  min-width: 0;
  max-height: 320px;
  margin: 0;
  padding: 4px;
  list-style: none;
  overflow-x: hidden;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #d2d6db;
  border-radius: 8px;
  box-shadow: 0 12px 24px -8px rgba(16, 24, 40, 0.2);
  text-align: start;
}
.db-topbar .searchable ul li {
  padding: 8px 12px;
  border-radius: 4px;
  color: #384250;
  font-size: 14px;
  line-height: 20px;
  text-align: start !important;
  cursor: pointer;
}
.db-topbar .searchable ul li.selected,
.db-topbar .searchable ul li:hover { background: #f3fcf6; color: #14573a; }

/* Language switch (b:commandLink), pfc-btn--secondary-outline look */
.db-lang-form { display: flex; align-items: center; margin: 0; }
.db-lang,
.db-lang:link,
.db-lang:visited {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px !important;
  border: 1px solid #d2d6db !important;
  border-radius: 4px !important;
  background: #ffffff !important;
  color: #161616 !important;
  font-family: 'IBM Plex Sans Arabic', sans-serif !important;
  font-size: 14px !important;
  text-decoration: none !important;
  white-space: nowrap;
}
.db-lang:hover { background: #f3f4f6 !important; border-color: #9da4ae !important; }
.db-lang:focus-visible { outline: 2px solid #161616 !important; outline-offset: 0; }
.db-lang img { width: 18px; height: 18px; }

/* Signed-in user chip: name, department, avatar (avatar opens «change user account») */
.db-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 4px;
  padding-inline-start: 12px;
  border-radius: 8px;
  background: #f3f4f6;
}
.db-user-copy { display: flex; flex-direction: column; min-width: 0; }
.db-user .c-head {
  max-width: 220px;
  margin: 0;
  overflow: hidden;
  color: #161616;
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.db-user-role {
  max-width: 220px;
  overflow: hidden;
  color: #6c727e;
  font-size: 12px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.db-user-role:empty { display: none; }
.db-avatar-link { display: inline-flex; flex-shrink: 0; border-radius: 9999px; }
.db-avatar-link:focus-visible { outline: 2px solid #161616; outline-offset: 2px; }
.db-avatar {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  object-fit: cover;
  background: #ffffff;
  border: 2px solid #ffffff;
}

/* ── Breadcrumb (pfc-breadcrumb) ─────────────────────────── */
.db-crumbs { padding: 0 4px 12px; }
/* a trail with the current page only says nothing: hide it */
.db-crumbs:has(li:only-child) { display: none; }
.db-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: none;
  font-size: 14px;
  line-height: 20px;
}
.db-breadcrumb li { display: inline-flex; align-items: center; gap: 8px; color: #384250; }
.db-breadcrumb li + li::before {
  content: '';
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239da4ae' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 6l-6 6 6 6'/%3E%3C/svg%3E") no-repeat center / 16px 16px;
}
[dir="ltr"] .db-breadcrumb li + li::before { transform: scaleX(-1); }
.db-breadcrumb a,
.db-breadcrumb a:link,
.db-breadcrumb a:visited { color: #384250; text-decoration: none; }
.db-breadcrumb a:hover { text-decoration: underline; }
.db-breadcrumb a:focus-visible { outline: 2px solid #161616; outline-offset: 2px; border-radius: 3px; }
.db-breadcrumb li:last-child a,
.db-breadcrumb li.active a,
.db-breadcrumb a.active { color: #9da4ae; pointer-events: none; }

/* ── Page title card (pfc-template-toolbar) ──────────────── */
.db-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: #ffffff;
  border: 1px solid #d2d6db;
  border-radius: 16px;
}
.db-toolbar-copy { min-width: 0; }
.db-toolbar .db-title {
  margin: 0;
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-size: 30px;
  line-height: 1.4;
  font-weight: 600;
  color: #1f2a37;
  text-align: start;
}
.db-intro {
  max-width: 720px;
  margin: 8px 0 0;
  color: #6c727e;
  font-size: 16px;
  line-height: 24px;
}
.db-toolbar-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ── Content ────────────────────────────────────────────── */
.db-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding-top: 16px;
}

/* white section (pfc-template-surface) */
.db-surface {
  padding: 24px;
  background: #ffffff;
  border: 1px solid #d2d6db;
  border-radius: 16px;
}
/* needs action: a bar on the inline-start edge sets it apart */
.db-surface--action { border-inline-start: 6px solid #f79009; }

/* long text (usage policies) */
.db-prose { padding: 24px 32px 32px; }
.db-prose h1,
.db-prose h2 {
  margin: 32px 0 12px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-size: 20px;
  line-height: 30px;
  font-weight: 600;
  color: #1f2a37;
}
.db-prose > :first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.db-prose p {
  max-width: 80ch;
  margin: 0 0 12px;
  color: #384250;
  font-size: 16px;
  line-height: 1.9;
}
.db-prose > :last-child { margin-bottom: 0; }

/* rows (announcements, required action) */
.db-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.db-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #d2d6db;
  border-radius: 12px;
}
.db-surface--action .db-item { padding: 0; border: 0; }
.db-item-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: #ecfdf3;
  color: #067647;
}
.db-item-icon img { width: 24px !important; height: 24px !important; object-fit: contain; }
.db-item-icon svg { width: 22px; height: 22px; }
.db-item--warn .db-item-icon { background: #fffaeb; color: #b54707; }
.db-item-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
  font-size: 14px;
  line-height: 22px;
}
.db-item-copy label { margin: 0; font-weight: 400; }
.db-item-copy a { color: #1b8354; text-decoration: underline; }
.db-action-text { color: #161616; font-size: 18px; line-height: 28px; font-weight: 600; }

/* ── Services ───────────────────────────────────────────── */
.db-services {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.db-service,
.db-service:link,
.db-service:visited {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #d2d6db;
  border-radius: 12px;
  color: #161616 !important;
  text-decoration: none !important;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.db-service:hover {
  border-color: #1b8354;
  background: #f3fcf6;
  box-shadow: 0 4px 12px -4px rgba(16, 24, 40, 0.12);
}
.db-service:active { background: #dff6e7; }
.db-service:focus-visible { outline: 2px solid #161616; outline-offset: 2px; }

.db-service-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #f3fcf6;
  transition: background 0.15s ease;
}
.db-service:hover .db-service-icon { background: #ffffff; }
.db-service-icon img { width: 36px; height: 36px; object-fit: contain; }

.db-service-name {
  flex: 1;
  min-width: 0;
  color: #161616;
  font-size: 15px;
  line-height: 22px;
  font-weight: 600;
}

.db-service-go {
  flex: none;
  width: 18px;
  height: 18px;
  color: #6c727e;
  transition: color 0.15s ease;
}
.db-service:hover .db-service-go { color: #1b8354; }
[dir="rtl"] .db-service-go { transform: scaleX(-1); }

/* ── Account cards (user selection / change account) ────── */
.db-accounts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.db-accounts > form { display: contents; }

.db-account {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: #ffffff;
  border: 1px solid #d2d6db;
  border-radius: 16px;
  transition: border-color 0.15s ease;
}
.db-account:hover { border-color: #9da4ae; }
.db-account--current,
.db-account--current:hover { border-color: #1b8354; box-shadow: inset 0 0 0 1px #1b8354; }

.db-account-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.db-account-avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  object-fit: cover;
  background: #f3fcf6;
}
.db-account-id { flex: 1; min-width: 0; }
.db-account-name,
.db-account-name label {
  margin: 0;
  color: #161616;
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.db-account-user {
  color: #1b8354;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
/* dir="auto" makes a Latin user name LTR; keep it under the name */
[dir="rtl"] .db-account-user { text-align: right; }
.db-account-check {
  display: grid;
  flex: none;
  place-items: center;
  align-self: flex-start;
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  background: #1b8354;
  color: #ffffff;
}
.db-account-check svg { width: 16px; height: 16px; }

.db-account-dept,
.db-account-dept label {
  flex: 1;
  margin: 0;
  color: #384250;
  font-size: 14px;
  line-height: 22px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

/* ── Buttons: pfc-btn--primary-brand (b:commandButton → <button>, h:commandButton → <input>) ── */
.db-btn,
.db-btn:link,
.db-btn:visited,
.btn.db-btn,
input.db-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 40px !important;
  margin: 0 !important;
  padding: 0 16px !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: #1b8354 !important;
  background-image: none !important;
  color: #ffffff !important;
  font-family: 'IBM Plex Sans Arabic', sans-serif !important;
  font-size: 16px !important;
  font-weight: 400 !important;
  line-height: normal !important;
  text-decoration: none !important;
  text-shadow: none !important;
  white-space: nowrap;
  box-shadow: none !important;
  cursor: pointer !important;
  transition: background 0.15s ease;
}
.db-btn:hover { background: #166a45 !important; color: #ffffff !important; }
.db-btn:active { background: #14573a !important; outline: 2px solid #161616 !important; }
.db-btn:focus { color: #ffffff !important; outline: none !important; }
.db-btn:focus-visible { outline: 2px solid #161616 !important; outline-offset: 0 !important; }

.db-btn--auto,
.db-btn--auto:link,
.db-btn--auto:visited { width: auto !important; }

/* pfc-btn--secondary-outline */
.db-btn--outline,
.db-btn--outline:link,
.db-btn--outline:visited {
  width: auto !important;
  border: 1px solid #d2d6db !important;
  background: #ffffff !important;
  color: #161616 !important;
}
.db-btn--outline:hover { background: #f3f4f6 !important; border-color: #9da4ae !important; color: #161616 !important; }
.db-btn--outline:active { background: #e5e7eb !important; }
.db-btn--outline:focus { color: #161616 !important; }

/* ── Footer: light line at the end of the content (pfc-footer--light) ── */
.db-footer {
  margin-top: auto;
  padding: 0 4px;
}
.db-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 32px;
  padding: 16px 0 20px;
  border-top: 1px solid #d2d6db;
  font-size: 13px;
  line-height: 20px;
}
.db-footer-copy { color: #6c727e; }
.db-footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.db-footer-links a,
.db-footer-links a:link,
.db-footer-links a:visited { color: #384250; text-decoration: none; }
.db-footer-links a:hover { color: #1b8354; text-decoration: underline; }

/* ── Small screens: sidebar becomes an off-canvas drawer ── */
@media (max-width: 991px) {
  .db-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    height: 100vh;
    transition: transform 0.2s ease;
  }
  [dir="rtl"] .db-sidebar { transform: translateX(100%); }
  [dir="ltr"] .db-sidebar { transform: translateX(-100%); }
  #sidebar.db-show .db-sidebar { transform: none; }

  #sidebar.db-show .db-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(12, 17, 27, 0.45);
  }

  .db-menu-btn { display: inline-flex; }
  .db-main { padding: 12px 12px 0; }
}

@media (max-width: 760px) {
  .db-user-copy { display: none; }
  .db-user { padding: 0; background: transparent; }
}

@media (max-width: 640px) {
  .db-topbar { flex-wrap: wrap; padding: 8px 12px; }
  .db-topbar .searchable { order: 5; flex: 1 1 100%; }
  .db-toolbar { padding: 16px; }
  .db-toolbar .db-title { font-size: 24px; }
  .db-intro { font-size: 14px; line-height: 22px; }
  .db-toolbar-actions { width: 100%; }
  .db-toolbar-actions .db-btn { flex: 1; }
  .db-surface { padding: 16px; }
  .db-prose { padding: 16px 16px 20px; }
  .db-prose h1, .db-prose h2 { font-size: 18px; line-height: 28px; }
  .db-services { grid-template-columns: 1fr; gap: 8px; }
  .db-service { min-height: 68px; }
  .db-service-icon { width: 44px; height: 44px; }
  .db-service-icon img { width: 30px; height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .db-sidebar, .db-service, .db-service-icon, .db-service-go, .db-account { transition: none; }
}
