* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background-color: #f0f0f0;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.app {
  position: relative;
  width: 100%;
  max-width: 75rem;
  min-height: 100dvh;
  background-color: #ffffff;
  overflow-x: hidden;
}

/* ===== CONTEÚDO PRINCIPAL (HOME) ===== */
.conteudo {
  width: 100%;
  max-width: 70rem;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 48px);
  min-height: 100dvh;
  padding-bottom: 32px;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

/* quando o menu estiver aberto, empurra/opaca o conteúdo */
.app.menu-aberto .conteudo {
  transform: translateX(30%);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.menu-icon {
  width: 44px;
  height: 44px;
  font-size: 24px;
  cursor: pointer;
  background: none;
  border: none;
}

.logo {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 1px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background-color: #ddd;
}

.saudacao {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
}

.banner-comunidade {
  background-color: #a9c3f5;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  min-width: 0;
}

.banner-texto strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.banner-texto span {
  font-size: 13px;
  color: #1a1a1a;
  overflow-wrap: anywhere;
}

.banner-comunidade img {
  width: 60px;
  height: 45px;
  border-radius: 8px;
  object-fit: cover;
}

.grid-botoes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

.botao {
  border-radius: 16px;
  padding: 24px 10px;
  text-align: center;
  cursor: pointer;
  border: none;
  min-height: 96px;
  text-decoration: none;
}

.botao .icone {
  font-size: 28px;
  margin-bottom: 8px;
}

.botao .label {
  font-weight: 700;
  font-size: 15px;
}

.botao.mapa { background-color: #34c165; color: #063d13; }
.botao.registrar { background-color: #2fa9f0; color: #06304a; }
.botao.historico { background-color: #f5a623; color: #4a2e00; }
.botao.comunidade { background-color: #dceaff; color: #10233d; }

.ocorrencias-titulo {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 12px;
}

.ocorrencia {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.ocorrencia.agua { background-color: #e3d9fb; }
.ocorrencia.vazamento { background-color: #f5f5f5; border: 1px solid #eee; }

.ocorrencia-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ocorrencia-icone { font-size: 20px; }

.ocorrencia-texto strong {
  display: block;
  font-size: 13px;
}

.ocorrencia-texto span {
  overflow-wrap: anywhere;
  font-size: 12px;
  color: #555;
}

.ocorrencia img {
  width: 55px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
}

/* ===== MENU LATERAL ===== */
.menu-lateral {
  position: absolute;
  top: 0;
  left: 0;
  width: min(82vw, 320px);
  height: 100%;
  background-color: #dbeeff;
  border-right: 2px solid #3b9cff;
  padding: 20px 15px;
  transform: translateX(-100%); /* começa escondido fora da tela */
  transition: transform 0.3s ease;
  z-index: 10;
}

.app.menu-aberto .menu-lateral {
  transform: translateX(0); /* desliza para dentro da tela */
}

.menu-fechar {
  width: 44px;
  height: 44px;
  font-size: 22px;
  cursor: pointer;
  margin-bottom: 40px;
  background: none;
  border: none;
}

.menu-lista {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu-lista li {
  min-height: 44px;
  padding: 10px 0;
  font-size: 16px;
  color: #222;
  cursor: pointer;
}

.menu-lista li:hover {
  font-weight: bold;
}

.divisor {
  border: none;
  border-top: 1px dashed #3b9cff;
  margin: 30px 0;
}

/* ===== OVERLAY (escurece o fundo quando o menu está aberto) ===== */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 5;
}

.app.menu-aberto .overlay {
  opacity: 1;
  pointer-events: auto; /* permite clicar fora do menu para fechar */
}

@media (min-width: 576px) {
  .conteudo {
    padding-top: 28px;
  }

  .grid-botoes {
    gap: 18px;
  }
}

@media (min-width: 768px) {
  .header {
    margin-bottom: 32px;
  }

  .saudacao {
    font-size: clamp(1.5rem, 3vw, 2rem);
  }

  .grid-botoes {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .ocorrencias {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .ocorrencia {
    margin-bottom: 0;
  }
}

@media (min-width: 992px) {
  .app {
    margin: 24px auto;
    min-height: calc(100dvh - 48px);
    border-radius: 20px;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.12);
  }

  .conteudo {
    min-height: calc(100dvh - 48px);
  }
}

/* Barra inferior unificada em todas as telas */
.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  min-height: 64px;
  height: auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  padding: 4px 8px max(4px, env(safe-area-inset-bottom));
  background: #d7e9fb;
  border-top: 1px solid #c7ddf7;
  border-radius: 0;
}

.bottom-nav .nav-item {
  display: flex;
  min-width: 44px;
  min-height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px 2px;
  color: #4a6a8a;
  font-size: 10px;
  text-align: center;
  text-decoration: none;
}

.bottom-nav .nav-item svg,
.bottom-nav .nav-item img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.bottom-nav .nav-item.active {
  color: #1a56db;
  font-weight: 700;
}

.bottom-nav .nav-item:hover {
  background: #f3f3f3;
}

.bottom-nav .nav-item {
  padding: 4px 2px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.bottom-nav .nav-item svg {
  width: 25px;
  height: 25px;
}

.bottom-nav .nav-item.active {
  font-weight: 800;
}

.bottom-nav .nav-item.active svg {
  stroke-width: 2.3;
}

@media (min-width: 1200px) {
  .conteudo {
    padding-left: 64px;
    padding-right: 64px;
  }
}

/* Navegação inferior compartilhada */
.navegacao {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  padding: 4px 8px max(4px, env(safe-area-inset-bottom));
  background: #d7e9fb;
  border-top: 1px solid #c7ddf7;
}

.navegacao-item {
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}

.conteudo {
  padding-bottom: calc(64px + 20px);
}

@media (min-width: 992px) {
  .app {
    margin: 0 auto;
    max-width: none;
    border-radius: 0;
    box-shadow: none;
  }

  .navegacao {
    left: 50%;
    right: auto;
    max-width: 75rem;
    transform: translateX(-50%);
  }
}