/* Precision Security shared portal header
   Quote Center + Service Portal + Secure Video Portal

   Master logo:
   /assets/brand/psaf-logo.png

   Future portal-header appearance changes should be made here once,
   rather than separately in each portal.
*/

body > header {
  position: relative !important;
  z-index: 30 !important;
  isolation: isolate !important;
  overflow: hidden !important;

  min-height: 176px !important;
  padding: 16px max(24px, calc((100% - 1480px) / 2)) !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 64px !important;
  flex-wrap: nowrap !important;

  background-color: #292c2f !important;
  background-image:
    radial-gradient(
      ellipse at 24% 44%,
      rgba(145, 18, 37, 0.10) 0%,
      rgba(100, 14, 26, 0.025) 31%,
      transparent 55%
    ),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.035) 0%,
      rgba(255, 255, 255, 0.008) 38%,
      rgba(0, 0, 0, 0.15) 100%
    ),
    linear-gradient(
      105deg,
      #222528 0%,
      #303336 38%,
      #2b2e31 62%,
      #202326 100%
    ) !important;

  border-bottom: 1px solid rgba(0, 0, 0, 0.88) !important;

  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    inset 0 -1px 0 rgba(255, 255, 255, 0.015) !important;

  backdrop-filter: none !important;
}

body > header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;

  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.009) 0,
      rgba(255, 255, 255, 0.009) 1px,
      transparent 1px,
      transparent 4px
    );

  opacity: 0.42;
}

body > header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  z-index: 3;
  pointer-events: none;

  background-image:
    linear-gradient(
      90deg,
      transparent 0%,
      rgba(120, 15, 30, 0.13) 18%,
      rgba(185, 25, 48, 0.45) 42%,
      rgba(185, 25, 48, 0.28) 58%,
      rgba(120, 15, 30, 0.09) 82%,
      transparent 100%
    );
}

body > header > * {
  position: relative !important;
  z-index: 2 !important;
}

body > header > .site-brand,
body > header > .brand {
  display: flex !important;
  align-items: center !important;
  gap: 28px !important;
  flex: 0 0 auto !important;

  color: #fff !important;
  text-decoration: none !important;
  font-size: 1.55rem !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}

body > header > .site-brand img,
body > header > .brand img {
  display: block !important;
  width: 390px !important;
  max-width: 38vw !important;
  height: auto !important;
  max-height: none !important;
  object-fit: contain !important;
  flex: 0 0 auto !important;

  filter:
    drop-shadow(7px 9px 8px rgba(0, 0, 0, 0.40))
    drop-shadow(2px 3px 2px rgba(0, 0, 0, 0.25)) !important;

  transition:
    filter 0.25s ease,
    transform 0.25s ease !important;
}

body > header > .site-brand:hover img,
body > header > .brand:hover img {
  filter:
    drop-shadow(9px 12px 10px rgba(0, 0, 0, 0.46))
    drop-shadow(2px 3px 2px rgba(0, 0, 0, 0.28)) !important;

  transform: translateY(-1px);
}

body > header > .site-brand > span,
body > header > .brand > span {
  display: block !important;
  min-width: max-content !important;
  color: #fff !important;
  font-size: 1.55rem !important;
  font-weight: 800 !important;
  line-height: 1.12 !important;
}

body > header > .site-brand small,
body > header > .brand small {
  display: block !important;
  margin-top: 9px !important;
  color: #e1a1ad !important;
  font-size: 0.76rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.035em !important;
  line-height: 1.2 !important;
}

body > header > nav {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  flex: 0 1 auto !important;
  flex-wrap: wrap !important;
}

body > header > nav .public-links {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  width: auto !important;
}

body > header > nav > span:not(.public-links) {
  color: #d5d9df !important;
  font-size: 0.86rem !important;
  font-weight: 700 !important;
}

body > header > nav a,
body > header > nav .public-links a {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  min-height: 44px !important;
  width: auto !important;
  padding: 0.76rem 1rem !important;

  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 13px !important;

  background:
    linear-gradient(
      180deg,
      #303438 0%,
      #25282c 55%,
      #1e2125 100%
    ) !important;

  color: #fff !important;
  font-size: 0.9rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  white-space: nowrap !important;

  box-shadow:
    0 7px 14px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.38) !important;

  transition:
    transform 0.2s ease,
    filter 0.2s ease,
    border-color 0.2s ease !important;
}

body > header > nav a:hover,
body > header > nav .public-links a:hover {
  transform: translateY(-2px) !important;
  filter: brightness(1.08) !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #fff !important;
}

body > header > nav a.sales-login,
body > header > nav.guest-nav a:last-child {
  background:
    linear-gradient(
      180deg,
      #9d1c31 0%,
      #841629 55%,
      #6d101f 100%
    ) !important;

  border-color: rgba(180, 36, 58, 0.68) !important;

  box-shadow:
    0 7px 15px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 -1px 0 rgba(65, 4, 14, 0.58) !important;
}

@media (max-width: 1240px) {
  body > header {
    min-height: 0 !important;
    padding: 16px 20px 20px !important;
    flex-direction: column !important;
    gap: 14px !important;
  }

  body > header > .site-brand,
  body > header > .brand {
    justify-content: center !important;
    width: 100% !important;
  }

  body > header > .site-brand img,
  body > header > .brand img {
    width: 370px !important;
    max-width: 58vw !important;
  }

  body > header > nav,
  body > header > nav .public-links {
    justify-content: center !important;
    width: 100% !important;
  }
}

@media (max-width: 720px) {
  body > header {
    align-items: center !important;
    padding: 14px 16px 18px !important;
  }

  body > header > .site-brand,
  body > header > .brand {
    gap: 14px !important;
  }

  body > header > .site-brand img,
  body > header > .brand img {
    width: 310px !important;
    max-width: 62vw !important;
  }

  body > header > .site-brand > span,
  body > header > .brand > span {
    font-size: 1.15rem !important;
  }

  body > header > .site-brand small,
  body > header > .brand small {
    margin-top: 5px !important;
    font-size: 0.64rem !important;
  }

  body > header > nav,
  body > header > nav .public-links {
    align-items: stretch !important;
  }

  body > header > nav a,
  body > header > nav .public-links a {
    flex: 1 1 170px !important;
  }
}

@media (max-width: 560px) {
  body > header > .site-brand,
  body > header > .brand {
    flex-direction: column !important;
    text-align: center !important;
  }

  body > header > .site-brand img,
  body > header > .brand img {
    width: 300px !important;
    max-width: 92vw !important;
  }

  body > header > nav,
  body > header > nav .public-links {
    flex-direction: column !important;
  }

  body > header > nav a,
  body > header > nav .public-links a {
    width: min(100%, 340px) !important;
    flex: 0 0 auto !important;
  }
}

/* =========================================================
   SIGNED-IN PORTAL HEADER ALIGNMENT
   Quote Center + Service Portal
   ========================================================= */

/*
 * Both authenticated headers contain six control items:
 * Quote: 6 links
 * Service: user name + 5 links
 *
 * On desktop they now use the same deliberate 3 x 2 control grid.
 * This prevents Sign out from dropping below the far-right edge.
 */
@media (min-width: 1241px) {
  body > header > nav.portal-admin-nav,
  body > header > nav.portal-user-nav {
    display: grid !important;
    grid-template-columns: repeat(3, max-content) !important;
    grid-auto-rows: minmax(44px, auto) !important;
    align-items: center !important;
    justify-content: end !important;
    align-content: center !important;
    gap: 10px !important;
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
  }

  body > header > nav.portal-admin-nav > *,
  body > header > nav.portal-user-nav > * {
    margin: 0 !important;
  }

  body > header > nav.portal-user-nav > .portal-user-name {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 44px !important;
    padding: 0.76rem 1rem !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 13px !important;
    background: rgba(0, 0, 0, 0.12) !important;
    color: #d8dce2 !important;
    font-size: 0.86rem !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  /* Keep the entire logo/title and control group centered as one unit. */
  body > header:has(> nav.portal-admin-nav),
  body > header:has(> nav.portal-user-nav) {
    gap: 48px !important;
    padding-left: max(24px, calc((100% - 1540px) / 2)) !important;
    padding-right: max(24px, calc((100% - 1540px) / 2)) !important;
  }

  /* Signed-in exit action receives the same controlled burgundy treatment. */
  body > header > nav.portal-admin-nav > a:last-child,
  body > header > nav.portal-user-nav > a:last-child {
    background:
      linear-gradient(
        180deg,
        #9d1c31 0%,
        #841629 55%,
        #6d101f 100%
      ) !important;

    border-color: rgba(180, 36, 58, 0.68) !important;

    box-shadow:
      0 7px 15px rgba(0, 0, 0, 0.30),
      inset 0 1px 0 rgba(255, 255, 255, 0.10),
      inset 0 -1px 0 rgba(65, 4, 14, 0.58) !important;
  }
}

/* Intermediate widths: retain two clean rows without forcing a full stack. */
@media (min-width: 901px) and (max-width: 1240px) {
  body > header > nav.portal-admin-nav,
  body > header > nav.portal-user-nav {
    display: grid !important;
    grid-template-columns: repeat(3, max-content) !important;
    justify-content: center !important;
    gap: 10px !important;
    width: auto !important;
  }

  body > header > nav.portal-user-nav > .portal-user-name {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 44px !important;
    padding: 0.76rem 1rem !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 13px !important;
    background: rgba(0, 0, 0, 0.12) !important;
    color: #d8dce2 !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
  }
}

/* Mobile: one full-width control per row for reliable touch targets. */
@media (max-width: 900px) {
  body > header > nav.portal-admin-nav,
  body > header > nav.portal-user-nav {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: center !important;
    width: min(100%, 360px) !important;
  }

  body > header > nav.portal-admin-nav > *,
  body > header > nav.portal-user-nav > * {
    width: 100% !important;
    text-align: center !important;
  }

  body > header > nav.portal-user-nav > .portal-user-name {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 42px !important;
    padding: 0.7rem 1rem !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 12px !important;
    background: rgba(0, 0, 0, 0.12) !important;
    color: #d8dce2 !important;
    font-weight: 800 !important;
  }
}

/* =========================================================
   SHARED PORTAL PAGE FLOW + LEGAL FOOTER
   Quote + Service + Secure Video + Banyan
   ========================================================= */

html {
  min-height: 100%;
}

body {
  min-height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
}

body > header {
  flex: 0 0 auto !important;
}

body > main {
  flex: 1 0 auto !important;
  min-height: 0 !important;
  min-width: 0;
}

body > footer.portal-footer {
  position: relative !important;
  z-index: 20 !important;
  flex: 0 0 auto !important;

  width: 100% !important;
  max-width: none !important;
  margin: auto 0 0 !important;
  padding: 0 !important;

  color: #98a1ad !important;
  background:
    linear-gradient(
      180deg,
      rgba(10, 11, 14, 0.98),
      rgba(6, 7, 9, 0.99)
    ) !important;

  border: 0 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.085) !important;

  box-shadow:
    0 -12px 30px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.018) !important;
}

.portal-footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  width: min(720px, 72vw);
  height: 1px;
  transform: translateX(-50%);
  pointer-events: none;

  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(181, 32, 57, 0.18) 18%,
      rgba(181, 32, 57, 0.50) 50%,
      rgba(181, 32, 57, 0.18) 82%,
      transparent
    );
}

.portal-footer-inner {
  width: min(1180px, calc(100% - 2rem));
  min-height: 76px;
  margin: 0 auto;
  padding: 18px 0;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 22px !important;
  flex-wrap: wrap !important;

  font-size: 0.9rem;
  text-align: center;
}

.portal-footer .portal-footer-links {
  width: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 11px !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
}

.portal-footer .portal-footer-links a {
  display: inline !important;
  min-height: 0 !important;
  width: auto !important;
  padding: 0 !important;

  color: #e1a1ad !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;

  font-size: 0.9rem !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  text-decoration: none !important;
  white-space: nowrap !important;

  transition:
    color 0.2s ease,
    transform 0.2s ease !important;
}

.portal-footer .portal-footer-links a:hover {
  color: #fff !important;
  filter: none !important;
  transform: translateY(-1px) !important;
}

.portal-footer-separator {
  color: rgba(255, 255, 255, 0.28);
}

.portal-footer p {
  margin: 0 !important;
  padding: 0 !important;
  color: #98a1ad !important;
  font-size: 0.9rem !important;
  line-height: 1.4 !important;
}

/* Short login/request pages fill the browser naturally.
   Long dashboards continue below the fold and push the footer downward. */
body > main.container,
body > main.shell {
  align-self: center;
}

/* Banyan's original stylesheet supplied a calculated minimum height.
   Flexbox now controls that consistently across all portal applications. */
body > main {
  max-height: none !important;
}

@media (max-width: 620px) {
  .portal-footer-inner {
    min-height: 0;
    padding: 20px 0;
    flex-direction: column !important;
    gap: 9px !important;
  }

  .portal-footer .portal-footer-links {
    gap: 9px !important;
  }
}
