/*
 * Muhdo.Common.Blazor layout shell: the fixed top bar (user block, organisation switcher, action pill, notification bell
 * and search box), the left navigation rail, the content area, the page header and the footer.
 *
 * Link once in index.html, after Bootstrap and muhdo-theme.css (an app's own theme sheet may sit between the two), and
 * before muhdo-toasts.css, muhdo-controls.css and the app's own overrides:
 * <link href="_content/Muhdo.Common.Blazor/css/muhdo-shell.css?v=<package version>" rel="stylesheet" />
 *
 * The colours read the tokens declared in muhdo-theme.css (--nav-*, --sidebar-fg, --topbar-*, --brand-*), which a portal
 * overrides to recolour the shell.
 */

.nav-user a { color: var(--nav-link); }
.content { background-color: var(--content-bg); }

/* Brand-tint hero surfaces (white-label aware) */
.auth-card { background:linear-gradient(180deg, var(--brand-50), var(--surface) 55%); }
.auth-card > .card-body { background-color: transparent; }

:root {
   --sidebar-w: 252px;
   --topbar-h: 70px;
}

.navbar-custom {
   position: fixed;
   top: 0;
   left: 0;
   right: 0;
   height: var(--topbar-h);
   background: var(--topbar-bg);
   color: var(--topbar-fg);
   border-bottom: 1px solid var(--topbar-line);
   box-shadow: var(--topbar-shadow);
   z-index: 1010;
}

   .navbar-custom .topbar {
      height: 100%;
      display: flex;
      align-items: center;
      gap: 16px;
      padding: 0 22px;
   }

.button-toggle-menu {
   background: none;
   border: none;
   font-size: 22px;
   color: var(--topbar-ink-600);
   place-items: center;
}

.logo-topbar img {
   max-height: 34px;
   width: auto;
}

.navbar-custom .topbar-menu {
   margin-left: auto;
}

.navbar-custom .nav-user .tb-name {
   color: var(--topbar-ink-900);
   font-weight: 700;
   font-size: 13px;
   line-height: 1.2;
}

.navbar-custom .nav-user .sub-text {
   color: var(--topbar-ink-400);
}

.navbar-custom .nav-user .organisation-switcher {
   color: inherit;
   width: 180px;
}

   .navbar-custom .nav-user .organisation-switcher:hover,
   .navbar-custom .nav-user .organisation-switcher:focus,
   .navbar-custom .nav-user .organisation-switcher[aria-expanded="true"] {
      color: var(--topbar-accent);
      outline: none;
   }

.navbar-custom .nav-user .organisation-switcher-menu {
   max-height: 320px;
   overflow-y: auto;
   padding: 4px 0;
   font-size: 13px;
   line-height: 1.4;
}

   .navbar-custom .nav-user .organisation-switcher-menu .dropdown-header {
      padding: 4px 12px;
      font-size: 11px;
   }

   .navbar-custom .nav-user .organisation-switcher-menu .dropdown-item {
      padding: 4px 12px;
   }

   .navbar-custom .nav-user .organisation-switcher-menu .avatar-xs {
      width: 18px;
      height: 18px;
   }

.navbar-custom .topbar-icon {
   color: var(--topbar-ink-500);
   font-size: 20px;
   display: inline-grid;
   place-items: center;
}

   .navbar-custom .nav-user .tb-name:hover,
   .navbar-custom .topbar-icon:hover {
      color: var(--topbar-accent);
   }

/* A plain text link in the top bar, such as a log-out link, takes this class for its colour. */
.navbar-custom .topbar-link {
   color: var(--topbar-link);
}

.topbar-actions {
   display: flex;
   background: var(--topbar-pill-bg);
   border: 1px solid var(--topbar-pill-line);
   border-radius: var(--r-md);
}

.topbar-action {
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   gap: 3px;
   min-width: 64px;
   padding: 7px 12px;
   color: var(--topbar-ink-500);
   transition: background .15s, color .15s;
}

   .topbar-action + .topbar-action {
      border-left: 1px solid var(--topbar-pill-line);
   }

   /* The pill leaves its overflow visible so the bell's ripple isn't cut off, so the end buttons round
      their own hover background to fit inside it. */
   .topbar-action:first-child {
      border-radius: calc(var(--r-md) - 1px) 0 0 calc(var(--r-md) - 1px);
   }

   .topbar-action:last-child {
      border-radius: 0 calc(var(--r-md) - 1px) calc(var(--r-md) - 1px) 0;
   }

   .topbar-action:hover {
      background: var(--topbar-accent-tint);
      color: var(--topbar-accent);
   }

   .topbar-action > i,
   .topbar-action .topbar-action-icon > i {
      font-size: 19px;
      line-height: 1;
   }

.topbar-action-icon {
   position: relative;
   display: inline-grid;
   place-items: center;
}

.topbar-action-label {
   font-size: 10px;
   font-weight: 600;
   letter-spacing: .02em;
   line-height: 1;
   white-space: nowrap;
}

.topbar-action .noti-icon-badge {
   position: absolute;
   top: -6px;
   right: -9px;
   margin: 0;
}

.leftside-menu {
   position: fixed;
   top: 0;
   left: 0;
   bottom: 0;
   width: var(--sidebar-w);
   background: var(--nav-bg);
   border-right: 1px solid rgba(13, 30, 40, .08);
   padding-top: 14px;
   overflow-y: auto;
   overflow-x: hidden;
   scrollbar-width: thin;
   z-index: 1020;
}

.side-nav {
   list-style: none;
   margin: 0;
   padding: 6px 10px 24px;
}

.side-nav-title {
   display: flex;
   align-items: center;
   padding: 16px 14px 6px;
   font-size: 10.5px;
   font-weight: 700;
   letter-spacing: .09em;
   text-transform: uppercase;
   color: color-mix(in srgb, var(--sidebar-fg) 55%, transparent);
}

.side-nav-link {
   display: flex;
   align-items: center;
   gap: 11px;
   padding: 10px 12px;
   margin: 2px 0;
   border-radius: 9px;
   color: var(--nav-link);
   font-size: 13.5px;
   font-weight: 500;
   transition: background .15s, color .15s;
}

   .side-nav-link > i {
      font-size: 18px;
      width: 20px;
      text-align: center;
   }

   .side-nav-link:hover {
      background: var(--nav-hover-bg);
      color: var(--sidebar-fg);
   }

   .side-nav-link.active {
      background: var(--nav-active-bg);
      color: var(--nav-active-fg);
      box-shadow: inset var(--nav-active-bar-width) 0 0 var(--nav-active-bar);
      border-radius: var(--nav-active-radius);
   }

.menu-arrow {
   margin-left: auto;
   font-size: 18px;
   line-height: 1;
   opacity: .55;
   transition: transform .2s;
}

.side-nav-link:not(.collapsed) .menu-arrow,
.side-nav-title:not(.collapsed) .menu-arrow {
   transform: rotate(180deg);
}

.side-nav-section {
   list-style: none;
   margin: 0;
   padding: 0;
}

.side-nav-second-level {
   list-style: none;
   margin: 2px 0 4px;
   padding: 0 0 0 16px;
}

   .side-nav-second-level .side-nav-link {
      padding: 8px 12px;
      font-size: 13px;
   }

.leftside-menu .logo-topbar {
   background: var(--nav-brand-bg);
   border-bottom: 1px solid color-mix(in srgb, var(--sidebar-fg) 8%, transparent);
   padding-bottom: 10px;
}

.leftside-menu .nav-user .lh-1 {
   flex: 1 1 auto;
}

.side-nav-title:hover,
.leftside-menu .nav-user .tb-name,
.leftside-menu .topbar-icon:hover {
   color: var(--sidebar-fg);
}

.leftside-menu .nav-user .sub-text {
   color: color-mix(in srgb, var(--sidebar-fg) 55%, transparent);
}

.leftside-menu .topbar-icon {
   color: color-mix(in srgb, var(--sidebar-fg) 75%, transparent);
}

.content-page {
   margin-left: var(--sidebar-w);
   padding-top: var(--topbar-h);
   min-height: 100vh;
   display: flex;
   flex-direction: column;
}

.content-page,
.page-title-box {
   animation: helixFadeIn 0.5s ease-in-out;
}

/* Opacity only, deliberately. A transform on .content-page makes it the containing block for every
   position:fixed descendant, which drops all the portal's drawers by the height of the topbar and
   leaves the page showing above them. */
@keyframes helixFadeIn {
   from {
      opacity: 0;
   }

   to {
      opacity: 1;
   }
}

.content.content-body {
   flex: 1;
   padding: 22px 0;
}

.footer {
   border-top: 1px solid var(--line-200);
   color: var(--ink-400);
}

.footer-alt {
   text-align: center;
   border-top: 0;
}

@media (max-width: 1399.98px) {
   .leftside-menu {
      transform: translateX(-100%);
      transition: transform .25s ease;
      box-shadow: var(--shadow-md);
   }

      .leftside-menu.open {
         transform: translateX(0);
      }

   .content-page {
      margin-left: 0;
   }

   /* Drawer mode (hamburger shown): the logo lives in the sidebar, so hide the topbar copy. */
   .navbar-custom .logo-topbar img {
      display: none;
   }

   .nav-backdrop.open {
      display: block;
      position: fixed;
      inset: 0;
      background: rgba(13, 30, 40, .45);
      z-index: 1015;
   }
}

.nav-backdrop {
   display: none;
}

@media (max-width: 991.98px) {
   .navbar-custom .topbar-menu {
      flex: 1;
      min-width: 0;
      margin-left: 0;
   }

   .navbar-custom .global-search {
      flex: 1;
      min-width: 0;
   }

   .navbar-custom .global-search-input,
   .navbar-custom .global-search-input:focus {
      flex: 1;
      min-width: 0;
      width: auto;
   }

   .navbar-custom .global-search-panel {
      position: fixed;
      top: calc(var(--topbar-h) - 6px);
      left: 10px;
      right: 10px;
      width: auto;
      max-height: 76vh;
   }
}

/* Phones: the topbar follows the nav rail unless the organisation has chosen its own topbar colour
   (the logo is already hidden from xxl down). */
@media (max-width: 767.98px) {
   .navbar-custom {
      background: var(--topbar-bg-sm);
      border-bottom-color: var(--topbar-line-sm);
   }

      .navbar-custom .button-toggle-menu {
         color: color-mix(in srgb, var(--topbar-ink-sm) 85%, transparent);
      }
}

.header-title {
   color: var(--page-title);
   letter-spacing: .3px;
   font-weight: 700;
}

.page-header-picker {
   width: 320px;
   max-width: 100%;
}

@media (max-width: 575.98px) {
   .page-header-picker {
      width: 100%;
   }
}

.noti-icon-badge {
   display: inline-flex;
   align-items: center;
   justify-content: center;
   min-width: 18px;
   height: 18px;
   padding: 0 5px;
   margin-left: -6px;
   vertical-align: top;
   font-size: 11px;
   font-weight: 600;
   line-height: 1;
   color: var(--brand-on);
   background-color: var(--brand);
   border-radius: 9px;
}

   .noti-icon-badge:empty {
      display: none;
   }

/* The bell rings and its badge pops each time the hub announces a notification; the badge ripples for as
   long as anything is unread. */
.bell-ring {
   transform-origin: 50% 2px;
   animation: bell-ring .9s ease-in-out;
}

.noti-icon-badge.bell-badge-pop {
   animation: bell-badge-pop .45s cubic-bezier(.3, 1.6, .5, 1);
}

.noti-icon-badge.bell-badge-ripple {
   animation: bell-badge-ripple 1.8s ease-out infinite;
}

.noti-icon-badge.bell-badge-pop.bell-badge-ripple {
   animation: bell-badge-pop .45s cubic-bezier(.3, 1.6, .5, 1), bell-badge-ripple 1.8s ease-out infinite;
}

@keyframes bell-ring {
   0%, 70%, 100% { transform: rotate(0); }
   10% { transform: rotate(16deg); }
   20% { transform: rotate(-14deg); }
   30% { transform: rotate(11deg); }
   40% { transform: rotate(-8deg); }
   50% { transform: rotate(5deg); }
   60% { transform: rotate(-3deg); }
}

@keyframes bell-badge-pop {
   0% { transform: scale(.4); }
   60% { transform: scale(1.35); }
   100% { transform: scale(1); }
}

@keyframes bell-badge-ripple {
   0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 55%, transparent); }
   100% { box-shadow: 0 0 0 8px transparent; }
}

@media (prefers-reduced-motion: reduce) {
   .bell-ring,
   .noti-icon-badge.bell-badge-pop,
   .noti-icon-badge.bell-badge-ripple {
      animation: none;
   }
}

.noti-close-btn {
   font-size: 16px;
   line-height: 1;
}

.global-search {
   position: relative;
   display: flex;
   align-items: center;
}

.global-search-btn {
   display: inline-grid;
   place-items: center;
   position: relative;
   z-index: 2;
   width: 40px;
   height: 38px;
   flex-shrink: 0;
   border: 0;
   border-radius: 0 var(--r-md) var(--r-md) 0;
   background: var(--brand);
   color: #FFFFFF;
   font-size: 18px;
   transition: background .15s ease;
}

   .global-search-btn:hover {
      background: var(--brand-600);
   }

.global-search-input {
   position: relative;
   z-index: 2;
   width: 240px;
   height: 38px;
   padding: 0 12px;
   font-size: 13px;
   color: var(--topbar-fg);
   background: var(--topbar-pill-bg);
   border: 1px solid var(--topbar-pill-line);
   border-right: 0;
   border-radius: var(--r-md) 0 0 var(--r-md);
   outline: none;
   transition: width .15s ease, border-color .15s ease, box-shadow .15s ease;
}

   .global-search-input::placeholder {
      color: var(--topbar-ink-400);
   }

   .global-search-input:focus {
      width: 300px;
      background: var(--topbar-pill-bg-focus);
      border-color: rgba(var(--brand-rgb), .45);
      box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12);
   }

.gs-backdrop {
   position: fixed;
   inset: 0;
   z-index: 1;
}

@media (min-width: 992px) {
   .global-search:has(.global-search-panel) .global-search-input {
      width: 300px;
   }
}

.global-search-panel {
   position: absolute;
   top: calc(100% + 8px);
   left: 0;
   right: 0;
   max-height: 70vh;
   overflow-y: auto;
   background: var(--surface);
   border: 1px solid var(--line-200);
   border-radius: var(--r-lg);
   box-shadow: var(--shadow-lg);
   z-index: 1011;
   padding: 6px;
}

.gs-panel-head {
   display: flex;
   justify-content: flex-end;
   padding: 0 0 2px;
}

.gs-close {
   display: inline-grid;
   place-items: center;
   width: 26px;
   height: 26px;
   background: none;
   border: none;
   color: var(--ink-400);
   border-radius: var(--r-sm);
   font-size: 16px;
}

   .gs-close:hover {
      color: var(--ink-700);
      background: var(--surface-2);
   }

.gs-group {
   padding: 4px 0;
}

.gs-group-empty {
   opacity: .42;
}

.gs-group + .gs-group {
   border-top: 1px solid var(--line-200);
}

.gs-group-head {
   display: flex;
   align-items: center;
   gap: 8px;
   padding: 8px 10px 4px;
   font-size: 10.5px;
   font-weight: 700;
   letter-spacing: .07em;
   text-transform: uppercase;
   color: var(--ink-400);
}

   .gs-group-head > i {
      font-size: 15px;
      color: var(--brand-600);
   }

.gs-group-name {
   flex: 1;
}

.gs-group-count {
   font-weight: 600;
   color: var(--ink-500);
   background: var(--surface-2);
   border-radius: 9px;
   padding: 0 7px;
   font-size: 10px;
}

.gs-spinner {
   color: var(--ink-400);
   font-size: 14px;
}

.gs-pending {
   display: flex;
   align-items: center;
   justify-content: center;
   padding: 26px 0;
   color: var(--ink-400);
   font-size: 22px;
}

.gs-row {
   display: flex;
   flex-direction: column;
   gap: 1px;
   padding: 7px 10px;
   border-radius: var(--r-sm);
}

   .gs-row:hover {
      background: rgba(var(--brand-rgb), .10);
   }

.gs-primary {
   font-weight: 600;
   font-size: 13px;
   color: var(--ink-900);
}

.gs-secondary {
   font-size: 11.5px;
   color: var(--ink-400);
}

.gs-see-all {
   display: flex;
   align-items: center;
   justify-content: flex-end;
   gap: 4px;
   padding: 6px 10px;
   font-size: 12px;
   font-weight: 600;
   color: var(--brand-600);
}

   .gs-see-all:hover {
      color: var(--brand-700);
   }

.content-body {
   min-height: 80vh;
}

.fade-in {
   animation: fadeInAnimation 0.5s forwards;
}

@keyframes fadeInAnimation {
   from {
      opacity: 0;
   }

   to {
      opacity: 1;
   }
}

.fade-out {
   animation: fadeOutAnimation 0.1s forwards;
}

@keyframes fadeOutAnimation {
   from {
      opacity: 1;
      display: block;
   }

   to {
      opacity: 0;
      display: none;
   }
}
