/* Layout chrome ported from the scoped <style> blocks of the legacy Vue layouts.
   Theme colours, the admin shell (.sidebar/.page-content) and pills come from
   /assets/css/style.css and admin-custom.css. */

/* ---- Logo swap (no hydration mismatch: decided by CSS, not JS) ----
   !important: the theme sets `.navbar-expand* .navbar-brand .navbar-brand-item { display:block }`. */
.logo-on-dark { display: none !important; }
[data-bs-theme='dark'] .logo-on-light,
.header-transparent .logo-on-light { display: none !important; }
[data-bs-theme='dark'] .logo-on-dark,
.header-transparent .logo-on-dark { display: block !important; }

/* ---- Site header ---- */
.app-header-container {
  width: 100%;
  padding-top: 1.6rem;
  transition: all 0.3s ease-in-out;
}
.header-sticky {
  position: sticky;
  top: 0;
  z-index: 1030;
  background-color: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
[data-bs-theme='dark'] .header-sticky {
  background-color: var(--bs-body-bg, #111827);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}
.header-transparent {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 1030;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
/* The opened mobile menu needs a backdrop on transparent headers. */
@media (max-width: 1199.98px) {
  .header-transparent .navbar-collapse.show {
    background: rgba(15, 23, 42, 0.96);
    border-radius: 0.75rem;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
  }
}

.app-header-container .navbar-nav .nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.45rem 0.65rem;
  white-space: nowrap;
  transition: color 0.2s ease-in-out;
}
.navbar-light .navbar-nav .nav-link { color: #1e293b; }
.navbar-light .navbar-nav .nav-link:hover,
.navbar-light .navbar-nav .nav-link:focus,
.navbar-light .navbar-nav .nav-link.active,
.navbar-light .navbar-nav .nav-link.active i { color: #5143d9; }
.navbar-light .navbar-nav .nav-link.active { font-weight: 600; }
[data-bs-theme='dark'] .navbar-light .navbar-nav .nav-link { color: rgba(255, 255, 255, 0.85); }
[data-bs-theme='dark'] .navbar-light .navbar-nav .nav-link:hover { color: #fff; }
[data-bs-theme='dark'] .navbar-light .navbar-nav .nav-link.active,
[data-bs-theme='dark'] .navbar-light .navbar-nav .nav-link.active i { color: #a78bfa; }
.header-transparent .navbar-dark .nav-link { color: rgba(255, 255, 255, 0.88); }
.header-transparent .navbar-dark .nav-link:hover { color: #fff; }
.header-transparent .navbar-dark .nav-link.active,
.header-transparent .navbar-dark .nav-link.active i { color: #ff9f1c; font-weight: 600; }

.app-header-container .dropdown-menu { z-index: 1060; }

/* The theme opens navbar dropdowns on :hover at desktop widths and keeps every other
   menu at visibility:hidden — so a menu opened by click or keyboard (.show) would stay
   invisible. Make an explicitly opened menu visible too. */
.navbar .navbar-nav .dropdown > .dropdown-menu.show {
  visibility: visible;
  opacity: 1;
  top: 100%;
}

/* Animated hamburger */
.navbar-toggler-animation {
  width: 24px;
  height: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.navbar-toggler-animation span {
  display: block;
  height: 2px;
  width: 100%;
  background: currentColor;
  border-radius: 2px;
  transition: all 0.25s ease-in-out;
}
.navbar-toggler-animation.active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.navbar-toggler-animation.active span:nth-child(2) { opacity: 0; }
.navbar-toggler-animation.active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }
.header-transparent .navbar-toggler { color: #fff; }

.icon-bubble {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.avatar-initial {
  border-radius: 50%;
  background: var(--bs-primary);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.shadow-xs { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.h-40px { height: 40px; }

/* ---- Account sidebars (customer / agency / supplier) ---- */
.account-sidebar .nav-header {
  font-size: 11px;
  letter-spacing: 0.5px;
}
.account-sidebar .nav-link {
  display: flex;
  align-items: center;
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
}
.account-sidebar .nav-link.active i { color: #fff !important; }
.account-sidebar .group-toggle .collapse-icon,
.navbar.sidebar .collapse-icon { transition: transform 0.2s ease; }
.rotate-180 { transform: rotate(180deg); }

/* ---- Admin shell ---- */
.admin-sidebar-scroll {
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}
/*
 * The theme sizes .sidebar-content at 16.25rem and lets the scroll box grow to fit it, so the
 * menu's scrollbar added ~10px and spilled over .page-content (offset by exactly 16.25rem).
 * Pin the rail to 16.25rem and let the content shrink by the scrollbar instead.
 */
@media (min-width: 1200px) {
  .navbar.sidebar.navbar-expand-xl {
    width: 16.25rem;
    max-width: 16.25rem;
    overflow: hidden;
  }
  .navbar.sidebar.navbar-expand-xl .offcanvas,
  .navbar.sidebar.navbar-expand-xl .sidebar-content {
    width: 100%;
    min-width: 0;
  }
}
@media (max-width: 1199.98px) {
  .navbar.sidebar .offcanvas.show {
    visibility: visible;
    transform: none;
  }
  .admin-backdrop {
    position: fixed;
    inset: 0;
    background: #000;
    opacity: 0.5;
    z-index: 1040;
  }
}
.admin-mobile-restricted {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}
[data-bs-theme='dark'] .admin-mobile-restricted {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

/* ---- Mobile bottom navigation ---- */
.mobile-bottom-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 1030;
  height: 65px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
[data-bs-theme='dark'] .mobile-bottom-nav { background: rgba(17, 24, 39, 0.96); }
.mobile-bottom-nav .nav-item-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: all 0.15s ease-in-out;
  background: none;
  border: 0;
}
.mobile-bottom-nav .nav-label {
  font-size: 10px;
  font-weight: 500;
  margin-top: 2px;
}
.mobile-bottom-nav .active-nav,
.mobile-bottom-nav .guest-signin-nav { color: #2563eb !important; font-weight: 700; }
/* Leave room so the fixed bar never covers page content. */
@media (max-width: 767.98px) {
  .has-bottom-nav { padding-bottom: 72px; }
}

/* ---- Print: hide chrome ---- */
@media print {
  .app-header-container,
  .mobile-bottom-nav,
  .site-footer,
  .navbar.sidebar,
  .top-bar { display: none !important; }
}

/* Opened inside the Airgroups phone app (tablet layout): the app draws the header, so the site's bars go. */
html[data-in-app] .app-header-container,
html[data-in-app] .mobile-bottom-nav,
html[data-in-app] .site-footer { display: none !important; }
html[data-in-app] .has-bottom-nav { padding-bottom: 0 !important; }
