/* sininho.css — Painel de notificações flutuante */

/* Wrapper do sino — fixo no canto superior direito */
.notification-wrapper {
  position: absolute;
  top: 2px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  width: 36px;
  height: 36px;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  margin: 0;
  transform: none;
  cursor: default;
  color: var(--icon-color, var(--interactive-foreground, #333333));
  z-index: 1000;
}

.notification-wrapper.is-open {
  border-color: color-mix(in srgb, currentColor 38%, transparent);
  background: color-mix(in srgb, currentColor 14%, transparent);
  box-shadow: 0 3px 10px rgba(17, 24, 39, 0.18);
}

#btn-sino {
  width: 21px;
  height: 21px;
  cursor: pointer;
  transition: none;
  outline: none;
  fill: currentColor;
}

#btn-sino:hover {
  transform: none;
  opacity: 0.82;
}

#btn-sino:focus-visible {
  border-radius: 5px;
  outline: 2px solid var(--accent-color, var(--cor-botao, currentColor));
  outline-offset: 3px;
}

/* Badge de contagem — vermelho permanece semantico. */
#notif-count {
  position: absolute;
  top: -1px;
  right: -2px;
  background: #e63946;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.22);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  pointer-events: none;
}

/* Painel flutuante */
.notif-painel {
  position: fixed;
  top: 60px;       /* abaixo da navbar */
  right: 12px;
  width: 360px;
  max-width: calc(100vw - 24px);
  max-height: min(520px, calc(100dvh - 76px));
  background: var(--bg-color, #fff);
  color: var(--interactive-foreground, var(--text-color, #263244));
  border: 1px solid var(--border-color, #b8c2cf);
  border-top: 4px solid var(--accent-color, #4c51bf);
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.28);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: default;
}

.notif-painel.hidden {
  display: none;
}

/* Cabeçalho do painel */
.notif-painel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color, #dce2f5);
  background: color-mix(in srgb, var(--bg-color, #fff) 90%, var(--primary-color, #007bff));
  color: var(--interactive-foreground, var(--text-color, #263244));
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.notif-painel-header button {
  min-height: 30px;
  background: var(--bg-color, #fff);
  border: 1px solid var(--border-color, #cbd3e2);
  color: var(--interactive-foreground, var(--text-color, #333333));
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background-color 0.1s ease, border-color 0.1s ease;
}

.notif-painel-header button:hover {
  border-color: var(--accent-color, #4c51bf);
  background: color-mix(in srgb, var(--bg-color, #fff) 82%, var(--accent-color, #4c51bf));
}

/* Lista de notificações */
#notif-lista {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  padding: 9px;
  background: var(--bg-color, #fff);
  color: var(--interactive-foreground, var(--text-color, #333333));
  scrollbar-color: var(--border-color, #aeb6c2) transparent;
  scrollbar-width: thin;
}

.notif-item {
  padding: 11px 12px;
  margin-bottom: 6px;
  border: 1px solid var(--border-color, #d7dee8);
  border-radius: 8px;
  background: var(--bg-color, #fff);
  color: var(--interactive-foreground, var(--text-color, #333333));
  transition: background-color 0.1s ease, border-color 0.1s ease;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.notif-item:last-child {
  margin-bottom: 0;
}

.notif-destaque {
  background: color-mix(in srgb, var(--bg-color, #fff) 92%, var(--accent-color, #4c51bf));
  border-left: 4px solid var(--accent-color, #4c51bf);
}

.notif-lida {
  background: color-mix(in srgb, var(--bg-color, #fff) 96%, var(--border-color, #aeb6c2));
  border-left: 4px solid var(--border-color, #aeb6c2);
  opacity: 0.78;
}

.notif-titulo {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--interactive-foreground, var(--text-color, #222));
  margin-bottom: 2px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.notif-mensagem {
  font-size: 12px;
  color: var(--interactive-foreground, var(--text-color, #555));
  margin: 0 0 4px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.notif-data {
  display: block;
  font-size: 11px;
  color: var(--interactive-foreground, var(--text-color, #7b8492));
  opacity: .68;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.notif-acoes {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
}

.notif-btn-lida,
.notif-btn-ver {
  display: inline-block;
  font-size: 11px;
  background: transparent;
  min-height: 28px;
  border: 1px solid var(--accent-color, #4c51bf);
  color: var(--accent-color, #4c51bf);
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
  transition: background 0.15s, color 0.15s;
}

.notif-btn-lida:hover,
.notif-btn-ver:hover {
  background: var(--accent-color, #4c51bf);
  color: var(--cor-texto-botao-modal, var(--icon-color, #fff));
}

/* "Ver" e uma acao comum, nao um estado: usa o mesmo acento do painel. */
.notif-btn-ver {
  border-color: var(--accent-color, #4c51bf);
  color: var(--accent-color, #4c51bf);
}

.notif-vazia,
.notif-carregando,
.notif-erro {
  text-align: center;
  padding: 24px 16px;
  font-size: 13px;
  border: 1px dashed var(--border-color, #c5ced9);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-color, #fff) 96%, var(--accent-color, #4c51bf));
  color: var(--interactive-foreground, var(--text-color, #4b5563));
}

/* Celular: mantém o sino acessível e o painel dentro da área útil da tela. */
@media (max-width: 600px) {
  .notification-wrapper {
    position: absolute;
    top: 0;
    right: max(8px, env(safe-area-inset-right, 0px));
    left: auto;
    width: 40px;
    height: 40px;
    margin: 0;
    transform: none;
    border-radius: 11px;
  }

  #btn-sino {
    width: 23px;
    height: 23px;
  }

  .notif-painel {
    top: calc(58px + env(safe-area-inset-top, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    left: max(8px, env(safe-area-inset-left, 0px));
    width: auto;
    max-width: none;
    max-height: calc(
      100dvh - 70px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
    );
    border-radius: 12px;
    transform: none;
  }

  .notif-painel-header {
    gap: 10px;
    padding: 10px 12px;
    font-size: 14px;
  }

  .notif-painel-header button {
    min-height: 40px;
    padding: 7px 11px;
  }

  #notif-lista {
    padding: 8px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .notif-item {
    padding: 11px;
    margin-bottom: 7px;
  }

  .notif-acoes {
    gap: 8px;
    margin-top: 9px;
  }

  .notif-btn-lida,
  .notif-btn-ver {
    display: inline-flex;
    flex: 1 1 130px;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 7px 10px;
    text-align: center;
  }

  #notif-count {
    top: -4px;
    right: -4px;
    left: auto;
    transform: none;
  }
}

@media (max-width: 360px) {
  .notif-painel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .notif-painel-header button {
    width: 100%;
  }

  .notif-btn-lida,
  .notif-btn-ver {
    flex-basis: 100%;
    width: 100%;
  }
}
