/*
@fileoverview Shared visual foundation for the server-rendered admin platform shell.
@layer ui-public
@used-by src/core/render/ejs/layouts/app.ejs
@depends-on Bootstrap 5 RTL and the locally supplied Arabic variable font
هذه الطبقة تحصر الهوية البصرية في صفحات منصة الإدارة وتحافظ على أنماط الميزات الحالية.
*/
@font-face {
  font-family: "Sanad Noto Sans Arabic";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/public/assets/lib/noto-sans-arabic/arabic-wght.woff2") format("woff2");
}

body.platform-shell {
  --platform-accent: #1769aa;
  --platform-accent-strong: #0f568f;
  --platform-accent-soft: #e9f3fb;
  --platform-surface: #ffffff;
  --platform-bg: #f2f6fa;
  --platform-ink: #172c40;
  --platform-muted: #5c7184;
  --platform-line: #dbe5ed;
  --platform-sidebar-width: 18rem;
  --platform-topbar-height: 4.25rem;
  --platform-font-family: var(--font-arabic, "Sanad Noto Sans Arabic", "Noto Sans Arabic", Tahoma, "Segoe UI", sans-serif);

  min-height: 100vh;
  background:
    radial-gradient(ellipse at 18% 0%, rgba(218, 235, 249, .58), transparent 34rem),
    var(--platform-bg) !important;
  color: var(--platform-ink);
  font-family: var(--platform-font-family);
  font-size: 16px;
  line-height: 1.65;
}

[data-bs-theme="dark"] body.platform-shell {
  --platform-accent: #62b6ef;
  --platform-accent-strong: #8acbfa;
  --platform-accent-soft: #18344b;
  --platform-surface: #152233;
  --platform-bg: #0f1927;
  --platform-ink: #e5edf5;
  --platform-muted: #a4b4c3;
  --platform-line: #29394a;

  background:
    radial-gradient(ellipse at 18% 0%, rgba(23, 75, 114, .2), transparent 34rem),
    var(--platform-bg) !important;
}

body.platform-shell .admin-shell__topbar {
  position: relative;
  z-index: 1030;
  min-height: var(--platform-topbar-height);
  padding: .45rem 0;
  border-bottom: 1px solid var(--platform-line) !important;
  background: color-mix(in srgb, var(--platform-surface) 94%, transparent) !important;
  box-shadow: 0 4px 18px rgba(24, 48, 70, .055) !important;
  backdrop-filter: blur(14px);
}

body.platform-shell .admin-shell__topbar-inner {
  min-height: 3.25rem;
  padding-inline: clamp(1rem, 2.5vw, 2.25rem);
}

body.platform-shell .admin-shell__brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  margin: 0;
  color: var(--platform-ink);
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -.025em;
  text-decoration: none;
}

body.platform-shell .admin-shell__brand-mark {
  display: inline-grid;
  width: 2.45rem;
  height: 2.45rem;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--platform-accent) 24%, transparent);
  border-radius: .85rem;
  background: var(--platform-accent-soft);
  color: var(--platform-accent);
  font-size: 1rem;
}

body.platform-shell .admin-shell__topbar-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
}

body.platform-shell .admin-shell__theme-button,
body.platform-shell .admin-shell__menu-button {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 1px solid var(--platform-line);
  border-radius: .8rem;
  background: var(--platform-surface);
  color: var(--platform-ink);
}

body.platform-shell .admin-shell__theme-button {
  padding: .35rem .75rem;
  font-size: .875rem;
}

body.platform-shell .admin-shell__theme-button i {
  color: var(--platform-accent);
}

body.platform-shell .admin-shell__menu-button {
  padding: .55rem;
  color: var(--platform-accent);
}

body.platform-shell .admin-shell__menu-button:focus-visible,
body.platform-shell .admin-shell__theme-button:focus-visible,
body.platform-shell .admin-shell__brand:focus-visible,
body.platform-shell .admin-shell__link:focus-visible,
body.platform-shell .admin-shell__search:focus-visible,
body.platform-shell .admin-shell__sidebar .btn-close:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--platform-accent) 70%, white);
  outline-offset: 2px;
  box-shadow: none;
}

body.platform-shell .admin-shell__sidebar {
  --bs-offcanvas-width: min(var(--platform-sidebar-width), calc(100vw - 1.25rem));
  border-color: var(--platform-line);
  background: var(--platform-surface);
  color: var(--platform-ink);
}

body.platform-shell .admin-shell__sidebar-header {
  min-height: 4rem;
  border-bottom: 1px solid var(--platform-line);
}

body.platform-shell .admin-shell__sidebar-header .offcanvas-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 750;
}

body.platform-shell .admin-shell__sidebar-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.15rem 1rem 1rem;
}

body.platform-shell .admin-shell__sidebar-intro {
  padding: .1rem .35rem 0;
}

body.platform-shell .admin-shell__eyebrow {
  color: var(--platform-accent);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .04em;
}

body.platform-shell .admin-shell__sidebar-intro p {
  margin: .15rem 0 0;
  color: var(--platform-muted);
  font-size: .875rem;
}

body.platform-shell .admin-shell__search-wrap {
  position: relative;
}

body.platform-shell .admin-shell__search-wrap > i {
  position: absolute;
  z-index: 2;
  inset-inline-start: .9rem;
  top: 50%;
  color: var(--platform-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

body.platform-shell .admin-shell__search {
  min-height: 44px;
  padding-inline-start: 2.55rem;
  border-color: var(--platform-line);
  border-radius: .8rem;
  background-color: var(--platform-bg);
  color: var(--platform-ink);
  font-size: .9375rem;
}

body.platform-shell .admin-shell__search::placeholder {
  color: var(--platform-muted);
  opacity: .9;
}

body.platform-shell .admin-shell__navigation {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body.platform-shell .admin-shell__section {
  margin: 0 0 1.3rem;
}

body.platform-shell .admin-shell__section-title {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0 0 .5rem;
  padding: 0 .65rem;
  color: var(--platform-muted);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .035em;
}

body.platform-shell .admin-shell__section-title > i {
  color: var(--platform-accent);
  font-size: .85rem;
}

body.platform-shell .admin-shell__group {
  margin-top: .85rem;
}

body.platform-shell .admin-shell__group-title {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.75rem;
  margin: 0;
  padding: .4rem .7rem;
  color: var(--platform-ink);
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  border-radius: .65rem;
}

body.platform-shell .admin-shell__group-title::-webkit-details-marker {
  display: none;
}

body.platform-shell .admin-shell__group-title::after {
  content: "";
  width: .45rem;
  height: .45rem;
  margin-inline-start: auto;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  transition: transform .16s ease;
}

body.platform-shell details[open] > .admin-shell__group-title::after {
  transform: rotate(225deg);
}

body.platform-shell .admin-shell__group-title:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--platform-accent) 55%, transparent);
  outline-offset: 2px;
}

body.platform-shell .admin-shell__group-title > i {
  color: var(--platform-muted);
  font-size: .8rem;
}

body.platform-shell .admin-shell__link-list {
  display: grid;
  gap: .15rem;
  margin: .15rem 0 0;
  padding: 0;
  list-style: none;
}

body.platform-shell .admin-shell__link-list > li {
  min-width: 0;
}

body.platform-shell .admin-shell__link {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: .75rem;
  padding: .55rem .75rem;
  border-radius: .75rem;
  color: var(--platform-ink);
  font-size: .9375rem;
  line-height: 1.4;
  text-decoration: none;
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease;
}

body.platform-shell .admin-shell__link > i {
  width: 1.1rem;
  flex: 0 0 1.1rem;
  color: var(--platform-muted);
  text-align: center;
}

body.platform-shell .admin-shell__link > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

body.platform-shell .admin-shell__link:hover {
  background: color-mix(in srgb, var(--platform-accent-soft) 70%, var(--platform-surface));
  color: var(--platform-accent-strong);
}

body.platform-shell .admin-shell__link:hover > i,
body.platform-shell .admin-shell__link.is-active > i {
  color: var(--platform-accent);
}

body.platform-shell .admin-shell__link.is-active {
  background: var(--platform-accent-soft);
  box-shadow: inset -3px 0 0 var(--platform-accent);
  color: var(--platform-accent-strong);
  font-weight: 750;
}

body.platform-shell .admin-shell__empty-section {
  margin: .25rem 0 0;
  padding: .45rem .75rem;
  color: var(--platform-muted);
  font-size: .875rem;
}

body.platform-shell .admin-shell__no-results {
  margin: 0;
  padding: .85rem .75rem;
  border: 1px dashed var(--platform-line);
  border-radius: .75rem;
  color: var(--platform-muted);
  font-size: .875rem;
  text-align: center;
}

body.platform-shell .admin-shell__account {
  display: grid;
  gap: .55rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--platform-line);
}

body.platform-shell .admin-shell__account-identity {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: .75rem;
  padding: 0 .55rem;
}

body.platform-shell .admin-shell__avatar {
  display: inline-grid;
  width: 2.55rem;
  height: 2.55rem;
  flex: 0 0 2.55rem;
  place-items: center;
  border-radius: 50%;
  background: var(--platform-accent-soft);
  color: var(--platform-accent);
}

body.platform-shell .admin-shell__account-copy {
  display: grid;
  min-width: 0;
  line-height: 1.35;
}

body.platform-shell .admin-shell__account-copy strong {
  color: var(--platform-ink);
  font-size: .875rem;
}

body.platform-shell .admin-shell__account-copy small {
  overflow: hidden;
  color: var(--platform-muted);
  font-size: .875rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.platform-shell .admin-shell__logout,
body.platform-shell .admin-shell__logout > i {
  color: #ae3945;
}

body.platform-shell main.container {
  max-width: 1240px;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

body.platform-shell main.container:not(.d-flex) {
  transition: padding .2s ease;
}

body.platform-shell .card {
  border: 1px solid var(--platform-line) !important;
  border-radius: 14px;
  background-color: var(--platform-surface);
  color: var(--platform-ink);
  box-shadow: 0 8px 24px rgba(24, 48, 70, .045) !important;
}

body.platform-shell .card-header,
body.platform-shell .card-footer {
  background: var(--platform-surface);
  border-color: var(--platform-line);
  color: var(--platform-ink);
}

body.platform-shell .btn-primary {
  --bs-btn-bg: var(--platform-accent);
  --bs-btn-border-color: var(--platform-accent);
  --bs-btn-hover-bg: var(--platform-accent-strong);
  --bs-btn-hover-border-color: var(--platform-accent-strong);
}

body.platform-shell .table > :not(caption) > * > * {
  padding-top: .8rem;
  padding-bottom: .8rem;
  border-color: var(--platform-line);
}

body.platform-shell .dropdown-menu {
  border-color: var(--platform-line);
  border-radius: 10px;
  background-color: var(--platform-surface);
  color: var(--platform-ink);
  box-shadow: 0 12px 30px rgba(24, 48, 70, .1);
}

body.platform-shell .form-text,
body.platform-shell .admin-shell__help {
  color: var(--platform-muted);
  font-size: .875rem;
}

body.platform-shell [hidden] {
  display: none !important;
}

@media (min-width: 992px) {
  body.platform-shell .admin-shell__menu-button {
    display: none;
  }

  body.platform-shell .admin-shell__sidebar.offcanvas-lg {
    position: fixed;
    z-index: 1020;
    inset: var(--platform-topbar-height) 0 0 auto;
    display: flex;
    width: var(--platform-sidebar-width) !important;
    height: calc(100dvh - var(--platform-topbar-height)) !important;
    flex-direction: column;
    visibility: visible !important;
    transform: none !important;
    border: 0;
    border-inline-start: 1px solid var(--platform-line);
    border-radius: 0;
    box-shadow: 8px 0 28px rgba(24, 48, 70, .035);
  }

  body.platform-shell .admin-shell__sidebar-header {
    display: none;
  }

  body.platform-shell .admin-shell__sidebar-body {
    height: auto;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
    padding: 1.4rem 1rem 1rem;
  }

  body.platform-shell main.container:not(.d-flex) {
    width: auto;
    max-width: none;
    margin-inline-start: var(--platform-sidebar-width);
    margin-inline-end: 0;
    padding-inline: clamp(1.5rem, 3vw, 3rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.platform-shell *,
  body.platform-shell *::before,
  body.platform-shell *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

@media (max-width: 767.98px) {
  body.platform-shell main.container {
    padding-top: 1rem;
    padding-bottom: 2rem;
  }

  body.platform-shell .admin-shell__topbar-inner {
    padding-inline: .8rem;
  }
}
