/* ============================================
   NAVBAR — usada por index.html e programacao.html
   Desktop: barra no topo com ícone + rótulo.
   Celular e tablet (≤1024px): barra fixa no rodapé só com ícones,
   logo quadrada e botão "Voltar" vira seta.
   Carregar DEPOIS de styles.css / prog_styles.css / responsive.css.
   ============================================ */

/* Texto visível só para leitores de tela */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Links do menu ---------- */
header .app-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

header .app-nav:empty {
  display: none;
}

header .app-nav li {
  list-style: none;
  margin: 0;
}

header .app-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

header .app-nav a i {
  width: 18px;
  text-align: center;
  color: var(--primary);
  transition: color 0.2s ease;
}

header .app-nav a:hover {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  box-shadow: none;
  transform: none;
}

header .app-nav a.active {
  background: var(--primary);
  color: #fff;
}

header .app-nav a.active i {
  color: #fff;
}

/* Cabeçalho da programacao.html */
header nav.app-header {
  gap: 12px;
}

/* ---------- Logo ---------- */
.app-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* ---------- Botão Voltar (programacao.html) ---------- */
.btn-voltar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

/* ---------- Usuário (nome + trocar senha + sair) ---------- */
header .user {
  min-width: 0;
}

header .user .muted {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.btn-logout {
  flex-shrink: 0;
}

/* ============================================
   DESKTOP — menu sempre em uma linha
   ============================================ */
@media (min-width: 1025px) {
  header .app-nav {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    justify-content: center;
    min-width: 0;
  }

  .app-logo img.logo {
    width: 160px;
  }
}

@media (min-width: 1025px) and (max-width: 1439px) {
  header .brand {
    display: none;
  }

  header .app-nav a {
    gap: 6px;
    padding: 7px 9px;
    font-size: 0.9rem;
  }

  header .user .muted {
    max-width: 150px;
  }
}

@media (min-width: 1025px) and (max-width: 1300px) {
  header .app-nav a {
    padding: 6px 7px;
    font-size: 0.85rem;
  }

  .app-logo img.logo {
    width: 130px;
  }

  header .user .muted {
    max-width: 110px;
  }
}

/* ============================================
   CELULAR E TABLET
   ============================================ */
@media (max-width: 1024px) {
  /* backdrop-filter cria "containing block" e prenderia a barra fixa dentro do header */
  header {
    backdrop-filter: none;
    background: #fff;
  }

  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }

  /* Cabeçalho compacto em uma linha */
  header .topbar,
  header nav.app-header {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
  }

  header .brand {
    display: none;
  }

  .app-logo img,
  .app-logo img.logo {
    width: 40px;
    height: 40px;
    margin: 0;
    object-fit: contain;
  }

  .btn-voltar {
    order: -1;
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.1rem;
  }

  .btn-voltar .btn-text,
  .btn-logout .btn-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  header .user {
    flex: 1 1 auto;
    justify-content: flex-end;
    font-size: 0.85rem;
    max-width: none;
  }

  .btn-logout {
    padding: 8px 12px;
  }

  /* Menu vira barra inferior fixa só com ícones */
  header .app-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    flex-wrap: nowrap;
    justify-content: space-around;
    gap: 0;
    width: auto;
    height: auto;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
    transition: none;
  }

  header .app-nav li {
    flex: 1 0 auto;
    display: flex;
    justify-content: center;
  }

  header .app-nav a {
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    margin: 0;
    border-radius: 12px;
    font-size: 1rem;
  }

  header .app-nav a i {
    width: auto;
    font-size: 1.25rem;
  }

  header .app-nav .nav-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
}

@media (max-width: 360px) {
  /* responsive.css esconde .user aqui; manter trocar senha / sair visíveis */
  header .user {
    display: flex;
  }

  header .app-nav a {
    width: 42px;
    height: 44px;
  }
}

@media print {
  header .app-nav {
    display: none;
  }

  body {
    padding-bottom: 0;
  }
}
