/* =========================================
   AJUSTES BASE / RESET LEVE
========================================= */

th,
footer small {
  text-align: -webkit-match-parent;
  text-align: match-parent;
  text-align: inherit;
}

body {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto; /* ocupa o espaço restante */
}

footer {
  flex-shrink: 0; /* impede o footer de subir */
}

/* Utilitários */
:root {
  --bs-gutter-mobile: 1rem;
}

/* Cards adaptativos (geral) */
.card {
  height: auto !important;
  margin-bottom: 1rem;
}

/* Status pills (geral) */
.status-pill {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.875rem;
}

/* Steps (geral) */
.steps {
  display: flex;
  margin: 1rem 0;
}

/* =========================================
   ✅ BASE DO HEADER (vale para todo tamanho)
========================================= */

/* Avatar sempre redondo (independente do estado do menu) */
.user-avatar{
  width: 32px;
  height: 32px;
  border-radius: 50% !important;
  font-size: .875rem;
  font-weight: 600;
  color: #fff;
  flex: 0 0 32px;
}

/* Nome com ellipsis consistente */
.user-name-ellipsis{
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
}


/* =========================================
   MOBILE (até 768px) - BLOCO ÚNICO
========================================= */
@media (max-width: 768px) {

  /* Banner mais compacto em mobile */
  .banner-img,
  .banner-abuba,
  img[alt*="ABUBA"] {
    max-height: 180px !important;
  }

  /* ✅ Ajuste de padding APENAS nos cards da home */
  .home-card .card-body {
    padding: 1.5rem 1.25rem; /* mais respiro sem exagerar */
  }

  /* Botões full width no mobile */
  .btn {
    width: 100%;
    font-size: 1rem;
  }
  .btn + .btn {
    margin-top: 0.5rem;
  }

  /* Containers com gutter menor */
  .container {
    padding: 0 var(--bs-gutter-mobile);
  }

  /* Fix tabelas responsivas */
  .table-responsive {
    margin: 0 calc(-1 * var(--bs-gutter-mobile));
    width: calc(100% + (var(--bs-gutter-mobile) * 2));
    padding: 0 var(--bs-gutter-mobile);
  }

  /* Cards com imagem no topo */
  .card-img-top {
    height: 200px;
    object-fit: cover;
  }

  /* Status pills menores */
  .status-pill {
    font-size: 0.75rem;
  }

  /* Navbar mobile otimizada */
  .navbar-brand {
    font-size: 1.1rem;
  }
  .dropdown-header {
    font-size: 0.875rem;
  }

  /* Steps empilhados */
  .steps {
    flex-direction: column;
    gap: 0.5rem;
  }
  .step-item {
    width: 100%;
    text-align: left;
    padding: 0.5rem;
  }
  .step-item::after {
    display: none;
  }

  /* Forms responsivos */
  .form-label {
    margin-bottom: 0.25rem;
  }
  .form-control {
    font-size: 16px; /* Evita zoom iOS */
  }

  /* Tabelas responsivas para mobile */
  .table-mobile-cards tbody tr {
    display: flex;
    flex-direction: column;
    border: 1px solid #dee2e6;
    margin-bottom: 1rem;
    padding: 0.5rem;
  }
  .table-mobile-cards td {
    display: flex;
    padding: 0.25rem 0;
    border: none;
  }
  .table-mobile-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    margin-right: 0.5rem;
    min-width: 40%;
  }
  .table-mobile-cards thead {
    display: none;
  }

  /* Breadcrumb responsivo */
  .breadcrumb {
    margin: 0.5rem 0;
    font-size: 0.875rem;
  }
  .breadcrumb-item + .breadcrumb-item {
    padding-left: 0.5rem;
  }
  .breadcrumb-item + .breadcrumb-item::before {
    padding-right: 0.5rem;
  }

  /* ✅ Fix espaçamento/tipografia mobile (somente no conteúdo) */
  main .mt-5 {
    margin-top: 2rem !important;
  }
  main .mb-4 {
    margin-bottom: 1.5rem !important;
  }

  h1, .h1 {
    font-size: calc(1.2rem + 1vw);
  }
  h2, .h2 {
    font-size: calc(1.1rem + 0.75vw);
  }
  .page-header {
    margin-bottom: 1rem;
  }
}


/* =========================================
   ✅ NAVBAR COLAPSADA (até 991.98px)
   Corrige conflito avatar/nome ao abrir menu
========================================= */
@media (max-width: 991.98px) {

  /* garante que as UL dentro do collapse virem colunas 100% */
  .navbar-collapse .navbar-nav {
    width: 100%;
    padding-left: 0;
  }

  /* UL da direita (ms-auto) vira secção separada */
  .navbar-collapse .navbar-nav.ms-auto {
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid rgba(255,255,255,.25);
    align-items: flex-start !important;
  }

  .navbar-collapse .navbar-nav.ms-auto .nav-item {
    width: 100%;
  }

  /* linha avatar + nome */
  .navbar-collapse .navbar-nav.ms-auto .nav-item.d-flex {
    justify-content: flex-start;
    align-items: center;
    gap: .5rem;
    margin-bottom: .5rem;
  }

  /* nome ocupa o resto sem esmagar */
  .navbar-collapse .navbar-nav.ms-auto .user-name-ellipsis {
    max-width: calc(100% - 48px);
  }

  /* botão sair/entrar full width e sem offsets desktop */
  .navbar-collapse .navbar-nav.ms-auto .btn,
  .navbar-collapse .navbar-nav.ms-auto form .btn {
    width: 100%;
    margin-left: 0 !important;
  }
}

