/*
 * Header e footer da área logada Braspress (mesmo padrão do braspress_web).
 * Todas as classes usam o prefixo "bp-" para não conflitar com o CSS legado
 * (styles.css, menu.css, new/style.css e Bootstrap 3).
 *
 * Header em faixa única: os serviços ficam todos na tela Minha Conta, então o
 * header só identifica o usuário e oferece o caminho de volta a ela e o Sair.
 */

.bp-header,
.bp-footer {
  --bp-blue: #004e9a;
  --bp-blue-dark: #003e7b;
  --bp-blue-deep: #004181;
  --bp-orange: #d58500;
  --bp-on-brand: #ffffff;
  --bp-on-brand-muted: #b9cde6;
  --bp-border-on-brand: rgba(255, 255, 255, 0.35);
  --bp-radius: 4px;
  --bp-container: 1140px;
  --bp-font: Arial, Tahoma, sans-serif;
}

/* Reset local: neutraliza regras globais do legado (a, h3, hr, .navbar...) */
.bp-header,
.bp-header *,
.bp-footer,
.bp-footer * {
  box-sizing: border-box;
  font-family: var(--bp-font);
  line-height: 1.25;
  letter-spacing: normal;
  text-transform: none;
}

.bp-header a,
.bp-header a:visited,
.bp-header a:hover,
.bp-header a:focus,
.bp-footer a {
  text-decoration: none;
  font-weight: inherit;
}

.bp-header img,
.bp-footer img {
  display: block;
  max-width: none;
  border: 0;
}

.bp-header svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bp-header :focus-visible,
.bp-footer :focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.bp-container {
  width: 100%;
  max-width: var(--bp-container);
  margin: 0 auto;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ---------- Header ---------- */

.bp-header {
  position: relative;
  z-index: 1000;
  width: 100%;
  margin: 0 0 32px;
  font-size: 14px;
  color: var(--bp-on-brand);
}

.bp-topbar {
  display: flex;
  height: 70px;
  background: var(--bp-blue);
}

.bp-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bp-brand img {
  width: 190px;
  height: auto;
}

.bp-brand-divider {
  width: 1px;
  height: 22px;
  background: var(--bp-border-on-brand);
}

.bp-area-name {
  color: var(--bp-on-brand);
  font-size: 16px;
  font-weight: 700;
}

.bp-top-actions {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* "Minha Conta": no hover vira uma caixa igual à do Sair; ativo na própria
   tela, com traço laranja na base (o laranja nunca fica sob texto branco,
   que teria contraste 2,9:1) */
.bp-top-link,
.bp-top-link:visited {
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--bp-radius);
  color: var(--bp-on-brand);
  font-size: 14px;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.bp-top-link:hover,
.bp-top-link:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--bp-border-on-brand);
  color: var(--bp-on-brand);
}

.bp-header .bp-top-link.is-active {
  box-shadow: inset 0 -3px 0 var(--bp-orange);
  font-weight: 700;
}

/* Saudação: fundo translúcido */
.bp-greeting {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  min-width: 0;
  max-width: 340px;
  padding: 0 16px 0 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--bp-radius);
  color: var(--bp-on-brand);
}

.bp-avatar {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--bp-orange);
  color: var(--bp-blue);
  font-size: 12px;
  font-weight: 700;
}

.bp-greeting-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bp-greeting-text strong,
.bp-greeting-text small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bp-greeting-text strong {
  font-size: 14px;
  font-weight: 700;
}

.bp-greeting-text small {
  color: var(--bp-on-brand-muted);
  font-size: 12px;
}

/* Botão com contorno (Sair / Voltar ao site) */
.bp-btn,
.bp-btn:visited {
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--bp-border-on-brand);
  border-radius: var(--bp-radius);
  color: var(--bp-on-brand);
  font-size: 14px;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.bp-btn:hover,
.bp-btn:focus {
  background: rgba(255, 255, 255, 0.1);
  color: var(--bp-on-brand);
}

/* Atalho "Minha Conta" do mobile (ícone de casa) */
.bp-icon-link,
.bp-icon-link:visited {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bp-border-on-brand);
  border-radius: var(--bp-radius);
  color: var(--bp-on-brand);
}

.bp-icon-link svg {
  width: 22px;
  height: 22px;
}

/* Faixa inferior só no mobile: saudação + Sair */
.bp-subheader {
  display: none;
  padding: 6px 0;
  background: var(--bp-blue-dark);
}

/* ---------- Breadcrumb (mesmo visual do PageHeader do braspress_web) ---------- */

.bp-breadcrumb {
  padding: 16px 0 0;
  background: transparent;
}

.bp-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bp-breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: #5b6675;
  font-size: 12px;
}

.bp-breadcrumb li[aria-current="page"] {
  color: #343434;
  font-weight: 700;
}

.bp-header .bp-breadcrumb a,
.bp-header .bp-breadcrumb a:visited {
  color: #5b6675;
  font-size: 12px;
  font-weight: 400;
}

.bp-header .bp-breadcrumb a:hover,
.bp-header .bp-breadcrumb a:focus {
  color: #5b6675;
  text-decoration: underline;
}

.bp-header .bp-breadcrumb svg {
  width: 12px;
  height: 12px;
}

.bp-header .bp-breadcrumb :focus-visible {
  outline-color: var(--bp-blue);
}

/* Visibilidade por breakpoint */
.bp-only-mobile {
  display: none !important;
}

/* Mobile */
@media (max-width: 820px) {
  .bp-only-desktop {
    display: none !important;
  }

  .bp-only-mobile {
    display: flex !important;
  }

  .bp-subheader {
    display: block;
  }

  .bp-header {
    margin-bottom: 24px;
  }

  .bp-topbar {
    height: 64px;
  }

  .bp-brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .bp-brand img {
    width: 120px;
  }

  .bp-brand-divider {
    display: none;
  }

  .bp-area-name {
    font-size: 12px;
  }

  .bp-greeting {
    max-width: calc(100vw - 150px);
  }

  /* Login: no mobile o "Minha Conta" vira só o ícone de casa */
  .bp-top-actions-public {
    gap: 8px;
  }

  .bp-top-actions-public .bp-top-link {
    padding: 0 9px;
  }

  .bp-label-desktop {
    display: none;
  }
}

/* ---------- Footer ---------- */

.bp-footer {
  width: 100%;
  padding: 15px 0;
  background: var(--bp-blue-deep);
  color: var(--bp-on-brand);
  font-size: 12px;
}

.bp-footer img {
  width: 110px;
  height: auto;
}

.bp-footer p {
  margin: 0;
  color: var(--bp-on-brand-muted);
  font-size: 12px;
}

@media (max-width: 820px) {
  .bp-footer {
    padding: 18px 0;
  }

  .bp-footer .bp-container {
    flex-direction: column;
    justify-content: center;
    gap: 8px;
  }

  .bp-footer img {
    width: 100px;
  }

  .bp-footer p {
    font-size: 11px;
    text-align: center;
  }
}

/* Footer encostado no fim da página quando o conteúdo é curto.
   height:auto neutraliza páginas que fixam html/body em 100% (ex.: bi/view.jsp). */
body.bp-page {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 100vh;
  margin: 0;
}

/* Espaçador antes do footer: mínimo de 40px e cresce em páginas curtas */
.bp-footer-spacer {
  flex: 1 0 40px;
  min-height: 40px;
}

@media print {
  .bp-header,
  .bp-footer {
    display: none !important;
  }
}
