/* ============================================================================
   Unity Surge admin shell
   Re-lays-out the sidebar / top bar / content skeleton that the admin pages
   share (#navbar.sidebar + #mainContent.main-content). Every rule is scoped to
   html.us-shell, which admin-shell.js adds only after it has found that
   skeleton, so pages without it are untouched. Colours come from theme.css.
   ========================================================================= */

.us-shell {
  --us-sb-w: 256px;        /* sidebar, expanded */
  --us-sb-rail: 76px;      /* sidebar, collapsed to an icon rail */
  --us-top-h: 62px;
  --us-sb-w-now: var(--us-sb-w);
}
.us-shell.us-rail { --us-sb-w-now: var(--us-sb-rail); }

.us-shell body {
  font-family: "Plus Jakarta Sans", "Inter", "Segoe UI", system-ui, sans-serif;
  background-image: none !important;
}

/* ---------- Sidebar ---------- */
.us-shell .sidebar {
  width: var(--us-sb-w-now) !important;
  height: 100vh;
  position: fixed; top: 0; left: 0; z-index: 200;
  display: flex; flex-direction: column;
  background: var(--us-surface) !important;
  border-right: 1px solid var(--us-border) !important;
  box-shadow: none;
  overflow: hidden;
  animation: none !important;
  transform: none;
  transition: none;
}
/* Pages arrive with their own 220px sidebar; snapping straight to ours avoids a
   slide on every navigation. Transitions switch on once the first frame is up. */
.us-shell.us-ready .sidebar {
  transition: width .26s cubic-bezier(.4,0,.2,1), transform .26s cubic-bezier(.4,0,.2,1),
              background-color .2s, border-color .2s;
}
.us-shell .sidebar.hidden { transform: none; }     /* the old hide is now the rail */

/* brand */
.us-shell .sidebar-brand {
  height: var(--us-top-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px 0 18px !important;
  border-bottom: 1px solid var(--us-border) !important;
  flex: 0 0 auto;
}
.us-shell .sidebar-brand img { height: 42px !important; width: auto; max-width: 200px; object-fit: contain; }
.us-shell .sidebar-brand .us-brand-mini { display: none; height: 40px !important; width: 40px; }
.us-shell.us-rail .sidebar-brand { padding: 0 !important; justify-content: center; }
.us-shell.us-rail .sidebar-brand img:not(.us-brand-mini) { display: none; }
.us-shell.us-rail .sidebar-brand .us-brand-mini { display: block; }
.us-shell .sidebar-brand .toggle-btn { display: none !important; }   /* replaced by the rail button in the top bar */

/* user card */
.us-shell .user-block {
  margin: 14px 12px 6px !important;
  padding: 10px 12px !important;
  background: var(--us-surface-2) !important;
  border: 1px solid var(--us-border) !important;
  border-radius: 12px !important;
  flex: 0 0 auto;
}
.us-shell .user-avatar {
  width: 34px !important; height: 34px !important;
  border: 2px solid var(--us-primary) !important;
  box-shadow: 0 0 0 3px var(--us-primary-soft);
}
.us-shell .user-welcome { font-size: 9px; letter-spacing: .12em; color: var(--us-text-3) !important; }
.us-shell .user-name { font-size: 12.5px; color: var(--us-text) !important; }
.us-shell.us-rail .user-block { margin: 12px 10px 4px !important; padding: 8px 0 !important; display: flex; justify-content: center; background: transparent !important; border-color: transparent !important; }
.us-shell.us-rail .user-block > div > div:last-child { display: none; }
.us-shell.us-rail .user-block .d-flex { justify-content: center; }

/* nav */
.us-shell .nav-links { padding: 6px 0 10px !important; }
.us-shell .nav-section-label {
  font-size: 9.5px; letter-spacing: .14em;
  color: var(--us-text-3) !important;
  padding: 14px 20px 6px !important;
}
.us-shell.us-rail .nav-section-label {
  padding: 10px 0 4px !important; font-size: 0;
  text-align: center;
}
.us-shell.us-rail .nav-section-label::after {
  content: ""; display: inline-block; width: 20px; height: 1px;
  background: var(--us-border-strong);
}
.us-shell .nav-links a {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  height: 42px; padding: 0 10px 0 12px !important;
  margin: 2px 10px !important;
  width: calc(100% - 20px) !important;
  border-radius: 10px !important;
  font-size: 13.5px; font-weight: 600;
  color: var(--us-text-2) !important;
  opacity: 1 !important; animation: none !important;
  transition: background-color .15s, color .15s;
}
.us-shell .nav-links a i {
  width: 30px !important; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 14px !important;
  color: var(--us-text-3) !important;
  background: transparent;
  flex: 0 0 auto;
  transition: background-color .15s, color .15s;
}
.us-shell .nav-links a:hover { background: var(--us-surface-2) !important; color: var(--us-text) !important; }
.us-shell .nav-links a:hover i { color: var(--us-primary-2) !important; }
.us-shell .nav-links a.active {
  background: var(--us-primary-soft) !important;
  color: var(--us-text) !important;
}
.us-shell .nav-links a.active i { background: var(--us-grad); color: #fff !important; }
.us-shell .nav-links a.active::before {
  content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--us-primary);
}
.us-shell.us-rail .nav-links a { justify-content: center; padding: 0 !important; margin: 2px 12px !important; width: calc(100% - 24px) !important; }
.us-shell.us-rail .nav-links a span { display: none; }
.us-shell.us-rail .nav-links a.active::before { left: -12px; }

/* footer */
.us-shell .version-card {
  margin: 8px 12px 14px !important;
  padding: 10px 12px !important;
  background: var(--us-surface-2) !important;
  border: 1px solid var(--us-border);
  border-radius: 12px !important;
  display: flex; align-items: center; gap: 10px;
}
.us-shell .version-card::before { display: none; }
.us-shell .version-card .version-badge {
  font-size: 10px; font-weight: 800; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 999px;
  background: var(--us-grad); color: #fff;
}
.us-shell .version-card-title { font-size: 12px; font-weight: 700; color: var(--us-text-2) !important; }
.us-shell.us-rail .version-card { justify-content: center; padding: 8px 0 !important; }
.us-shell.us-rail .version-card-title { display: none; }

/* ---------- Main column ---------- */
.us-shell .main-content {
  margin-left: var(--us-sb-w-now) !important;
  min-height: 100vh;
  background: var(--us-bg);
  transition: none;
}
.us-shell.us-ready .main-content { transition: margin-left .26s cubic-bezier(.4,0,.2,1); }
.us-shell .main-content.expanded { margin-left: var(--us-sb-w-now) !important; }

.us-shell .top-header {
  height: var(--us-top-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px !important;
  position: sticky; top: 0; z-index: 150;
  background: color-mix(in srgb, var(--us-bg) 82%, transparent) !important;
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--us-border) !important;
}
.us-shell .top-header > .d-flex:first-child { gap: 12px !important; min-width: 0; flex: 1 1 auto; }
.us-shell .top-header > .d-flex:last-child { flex: 0 0 auto; }
.us-shell .top-header h5 {
  font-size: 15px; font-weight: 800; color: var(--us-text) !important;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.us-shell .top-header h5 i { color: var(--us-primary) !important; }
.us-shell #showNavbarBtn { display: none !important; }

.us-shell .us-crumb {
  display: none; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--us-text-3);
  padding-right: 12px; margin-right: 2px;
  border-right: 1px solid var(--us-border);
}
@media (min-width: 768px) { .us-shell .us-crumb { display: inline-flex; } }
.us-shell .us-crumb a { color: var(--us-text-3); }
.us-shell .us-crumb a:hover { color: var(--us-primary-2); }

/* icon buttons in the top bar (rail toggle, apps, theme) */
.us-shell .us-ibtn,
.us-shell .top-header .theme-toggle {
  width: 38px !important; height: 38px !important;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px !important;
  border: 1px solid var(--us-border) !important;
  background: var(--us-surface) !important;
  color: var(--us-text-2) !important;
  font-size: 15px !important;
  cursor: pointer;
  transition: border-color .15s, color .15s, background-color .15s;
}
.us-shell .us-ibtn:hover,
.us-shell .top-header .theme-toggle:hover {
  border-color: var(--us-primary) !important;
  color: var(--us-primary-2) !important;
  background: var(--us-primary-soft) !important;
}
.us-shell .us-ibtn i { transition: transform .2s; }
.us-shell.us-rail .us-rail-btn i { transform: rotate(180deg); }
.us-shell .us-menu-btn { display: none; }

.us-shell .top-header .profile-btn {
  height: 38px;
  padding: 0 12px 0 6px !important;
  border-radius: 999px !important;
  background: var(--us-surface) !important;
  border: 1px solid var(--us-border) !important;
  color: var(--us-text) !important;
  font-family: inherit;
}
.us-shell .top-header .profile-btn:hover { border-color: var(--us-primary) !important; }
.us-shell .top-header .profile-btn img { width: 28px !important; height: 28px !important; }

/* apps launcher */
.us-shell .us-apps { position: relative; }
.us-shell .us-apps-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 320px; padding: 10px;
  display: none; grid-template-columns: repeat(3, 1fr); gap: 6px;
  background: var(--us-surface); border: 1px solid var(--us-border);
  border-radius: 14px; box-shadow: var(--us-shadow-lg);
  z-index: 400;
}
.us-shell .us-apps.open .us-apps-menu { display: grid; }
.us-shell .us-apps-menu a {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px; border-radius: 10px;
  font-size: 11px; font-weight: 700; color: var(--us-text-2);
  text-align: center;
}
.us-shell .us-apps-menu a i {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; font-size: 14px;
  background: var(--us-surface-2); color: var(--us-primary-2);
}
.us-shell .us-apps-menu a:hover { background: var(--us-surface-2); color: var(--us-text); }
.us-shell .us-apps-menu a:hover i { background: var(--us-grad); color: #fff; }
.us-shell .us-apps-menu .us-apps-hd {
  grid-column: 1 / -1; padding: 4px 6px 2px;
  font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--us-text-3);
}

/* ---------- Content ---------- */
.us-shell .page-body {
  padding: 26px 28px 40px !important;
  width: 100%;
}

/* dashboard cards (welcome.php) */
.us-shell .dash-card,
.us-shell .activated-big-card,
.us-shell .modal-full-stat,
.us-shell .modal-stat-box {
  background: var(--us-surface) !important;
  border: 1px solid var(--us-border) !important;
  border-radius: 16px !important;
  box-shadow: none !important;
}
.us-shell .dash-card:hover,
.us-shell .activated-big-card:hover {
  transform: translateY(-2px) !important;
  border-color: var(--us-primary-line) !important;
  box-shadow: var(--us-shadow) !important;
}
.us-shell .card-title { font-size: 13.5px; font-weight: 800; color: var(--us-text) !important; }
.us-shell .stat-pill {
  background: var(--us-surface-2) !important;
  border: 1px solid var(--us-border) !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  min-width: 108px;
}
.us-shell .stat-pill:hover { background: var(--us-surface-3) !important; }
.us-shell .sp-num { font-size: 24px; letter-spacing: -.02em; }
.us-shell .sp-lbl { font-size: 10.5px; color: var(--us-text-2) !important; font-weight: 600; }
.us-shell .expand-btn {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--us-surface-2) !important;
  border: 1px solid var(--us-border) !important;
  color: var(--us-text-2) !important;
}
.us-shell .expand-btn:hover { background: var(--us-grad) !important; color: #fff !important; border-color: transparent !important; }
.us-shell .badge-up { background: var(--us-success-soft) !important; color: var(--us-success) !important; }
.us-shell .motivation-card {
  background: var(--us-grad-navy) !important;
  border: 1px solid var(--us-border) !important;
  border-radius: 16px !important;
}
.us-shell .motivation-card:hover { box-shadow: 0 18px 44px rgba(3,170,251,.22) !important; border-color: var(--us-primary-line) !important; }
.us-shell .month-days-row span.today-lbl { color: var(--us-primary-2) !important; }

/* generic content inside any admin page */
.us-shell .page-body .card { border-radius: 14px; }
.us-shell .page-body h5, .us-shell .page-body h4 { letter-spacing: -.01em; }

/* ---------- Mobile: sidebar becomes an off-canvas drawer ---------- */
.us-shell .us-backdrop {
  position: fixed; inset: 0; z-index: 190;
  background: rgba(2, 8, 16, .55);
  backdrop-filter: blur(2px);
  display: none;
}
@media (max-width: 991.98px) {
  .us-shell { --us-sb-w-now: 0px; }
  /* Pages add .hidden themselves under 992px; on desktop that class means
     "rail" to us, so it must not undo the drawer here. */
  .us-shell .sidebar, .us-shell .sidebar.hidden { width: var(--us-sb-w) !important; transform: translateX(-100%); }
  .us-shell .sidebar.us-open, .us-shell .sidebar.hidden.us-open { transform: none; box-shadow: var(--us-shadow-lg); }
  .us-shell .sidebar-brand img:not(.us-brand-mini) { display: block !important; }
  .us-shell .sidebar-brand .us-brand-mini { display: none !important; }
  .us-shell.us-rail .nav-links a span,
  .us-shell.us-rail .nav-section-label,
  .us-shell.us-rail .version-card-title,
  .us-shell.us-rail .user-block > div > div:last-child { display: initial; }
  .us-shell.us-rail .nav-links a { justify-content: flex-start; padding: 0 10px 0 12px !important; margin: 2px 10px !important; width: calc(100% - 20px) !important; }
  .us-shell.us-rail .nav-section-label { font-size: 9.5px; text-align: left; padding: 14px 20px 6px !important; }
  .us-shell.us-rail .nav-section-label::after { display: none; }
  .us-shell .main-content, .us-shell .main-content.expanded { margin-left: 0 !important; }
  .us-shell .us-rail-btn { display: none; }
  .us-shell .us-menu-btn { display: inline-flex; }
  .us-shell .us-backdrop.show { display: block; }
  .us-shell .page-body { padding: 18px 16px 32px !important; }
  .us-shell .top-header { padding: 0 14px !important; }
  .us-shell .top-header > .d-flex:last-child { gap: 8px !important; flex: 0 0 auto; }
  .us-shell .us-crumb { display: none; }
  /* avatar only - the name does not fit next to the other controls */
  .us-shell .top-header .profile-btn { padding: 0 4px !important; gap: 0 !important; font-size: 0 !important; width: 38px; justify-content: center; }
  .us-shell .top-header .profile-btn i { display: none; }
  .us-shell .us-apps-menu { width: min(320px, calc(100vw - 28px)); }
}

/* ---------- Motion (shell) ---------- */
@keyframes us-shell-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* page body rises in as a whole, then its first-level blocks stagger */
.us-shell.us-ready .page-body { animation: us-shell-in .4s cubic-bezier(.22,1,.36,1) both; }
.us-shell .page-body > * { animation: us-shell-in .5s cubic-bezier(.22,1,.36,1) both; }
.us-shell .page-body > :nth-child(2) { animation-delay: .06s; }
.us-shell .page-body > :nth-child(3) { animation-delay: .12s; }
.us-shell .page-body > :nth-child(4) { animation-delay: .18s; }
.us-shell .page-body > :nth-child(n+5) { animation-delay: .24s; }

/* nav: icon tile nudges, active item glows softly */
.us-shell .nav-links a i { transition: background-color .15s, color .15s, transform .18s cubic-bezier(.34,1.56,.64,1); }
.us-shell .nav-links a:hover i { transform: translateX(2px) scale(1.06); }
.us-shell .nav-links a.active i { box-shadow: 0 4px 12px rgba(3,170,251,.35); }

/* dashboard tiles: lift with a brand-tinted shadow, numbers brighten */
.us-shell .stat-pill { transition: transform .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .2s ease; }
.us-shell .stat-pill:hover { transform: translateY(-2px); border-color: var(--us-primary-line) !important; box-shadow: 0 8px 22px rgba(3,170,251,.14); }
.us-shell .stat-pill .sp-num { transition: text-shadow .2s ease; }
.us-shell .stat-pill:hover .sp-num { text-shadow: 0 0 18px currentColor; }
.us-shell .dash-card, .us-shell .activated-big-card, .us-shell .motivation-card {
  transition: transform .2s cubic-bezier(.22,1,.36,1), box-shadow .25s ease, border-color .2s ease !important;
}
.us-shell .expand-btn { transition: background .15s, color .15s, border-color .15s, transform .18s cubic-bezier(.34,1.56,.64,1); }
.us-shell .expand-btn:hover { transform: scale(1.1) rotate(8deg); }

/* top-bar controls: icon buttons lift, launcher menu pops */
.us-shell .us-ibtn, .us-shell .top-header .theme-toggle, .us-shell .top-header .profile-btn { transition: transform .15s ease, border-color .15s, color .15s, background-color .15s, box-shadow .2s; }
.us-shell .us-ibtn:hover, .us-shell .top-header .theme-toggle:hover, .us-shell .top-header .profile-btn:hover { transform: translateY(-1px); box-shadow: var(--us-shadow-sm); }
.us-shell .us-ibtn:active, .us-shell .top-header .theme-toggle:active { transform: translateY(0) scale(.96); }
.us-shell .us-apps.open .us-apps-menu { animation: us-pop .2s cubic-bezier(.22,1,.36,1) both; transform-origin: top right; }
.us-shell .us-apps-menu a i { transition: background .15s, color .15s, transform .18s cubic-bezier(.34,1.56,.64,1); }
.us-shell .us-apps-menu a:hover i { transform: translateY(-2px) scale(1.08); }

/* rail toggle icon eases through the flip */
.us-shell .us-rail-btn i { transition: transform .3s cubic-bezier(.22,1,.36,1); }

@media (prefers-reduced-motion: reduce) {
  .us-shell.us-ready .page-body, .us-shell .page-body > *, .us-shell .us-apps.open .us-apps-menu { animation: none !important; }
  .us-shell .nav-links a:hover i, .us-shell .stat-pill:hover, .us-shell .expand-btn:hover, .us-shell .us-ibtn:hover, .us-shell .us-apps-menu a:hover i { transform: none !important; }
}
