/*
 * Project overrides on top of material-dashboard.css.
 * Keep vendor CSS untouched; put responsive/app-specific fixes here.
 */

/* ---------- Sidenav: header / scrollable menu / footer as a column ---------- */
/* The theme gives the menu a fixed calc(100vh - 200px) height and pins the
   footer buttons absolutely over it, so the last links end up hidden behind
   "Support" / "Upgrade License" (and behind the mobile browser toolbar). */
#sidenav-main {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  overflow: hidden;
}

#sidenav-main > * {
  flex: 0 0 auto;
}

#sidenav-main #sidenav-collapse-main {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  overflow-y: auto;
}

#sidenav-main .sidenav-footer {
  position: static !important;
  padding-top: 0.5rem;
}

/* ---------- Off-canvas sidenav below xl (theme hides it < 1200px) ---------- */
.sidenav-backdrop {
  display: none;
}

@media (max-width: 1199.98px) {
  .g-sidenav-pinned .sidenav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9998; /* just under .sidenav (9999) */
    background: rgba(0, 0, 0, 0.35);
  }

  body.g-sidenav-pinned {
    overflow: hidden;
  }

  /* Leave room for the close button (#iconSidenav) in the header. */
  #sidenav-main .navbar-brand {
    padding-right: 3rem !important;
  }
}

#iconNavbarSidenav {
  border: 0;
  background: transparent;
  cursor: pointer;
}

/* ---------- Topbar on phones ---------- */
@media (max-width: 575.98px) {
  /* Reclaim the navbar's side margins; the page already has gutters. */
  #navbarBlur {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Second row: search grows, icons keep their size. */
  #navbar {
    flex-basis: 100%;
    flex-wrap: nowrap;
  }

  #navbar .navbar-search {
    flex: 1 1 auto;
    min-width: 0;
  }

  #navbar .navbar-search form {
    width: 100%;
  }

  #navbar .navbar-nav {
    width: auto; /* theme makes it 100% below lg, which starves the search */
    flex-shrink: 0;
  }
}

/* Server time: inline next to the clock on wide screens, a full-width
   popover under the topbar on narrow ones (the meta line is ~50 chars). */
@media (max-width: 767.98px) {
  #navbarBlur {
    position: relative;
  }

  #navbar .navbar-nav .nav-item {
    position: static;
  }

  #serverTimeBox {
    position: absolute;
    top: 100%;
    left: 0.75rem;
    right: 0.75rem;
    z-index: 1030;
    margin-left: 0 !important;
    padding: 0.5rem 0.75rem;
    white-space: normal !important;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
}

/* The schedule glyph sits low next to the other navbar icons. */
#serverTimeBtn .material-symbols-rounded {
  position: relative;
  top: -2px;
}
