/* =========================================
   LOGIN — botão na topbar + modal
   Usa as mesmas variáveis definidas em styles.css
   (--bg, --panel, --text, --accent, --aurora, --font-display, --font-body...)
   ========================================= */

/* Botão "Entrar" na topbar, ao lado da busca */
.topbar__login {
  order: 4;
  flex-shrink: 0;
  margin-left: 0.6rem;
}

.topbar__login-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 8px 18px;
  border-radius: 999px;
  border: none;
  background: var(--aurora);
  color: #0b0e1a;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 22px rgba(124, 158, 255, 0.25);
}

.topbar__login-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(124, 158, 255, 0.38);
}

/* Estado logado: avatar redondo no lugar do botão */
.topbar__user {
  order: 4;
  flex-shrink: 0;
  margin-left: 0.6rem;
  display: flex;
  align-items: center;
}

/* Pontinho de notificacao nao lida, no canto do avatar */
.topbar__avatar-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.topbar__notif-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  background: #e5484d;
  border: 2px solid var(--panel);
  color: #fff;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar__notif-dot.hidden {
  display: none;
}

/* Painel de notificacoes: ancorado do lado direito do wrapper do usuario
   (mesmo container do avatar/menu), igual ao .user-menu ja faz -- assim
   nao vaza pra fora da tela perto da borda direita. */
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-width: min(320px, calc(100vw - 2rem));
  max-height: 380px;
  overflow-y: auto;
  border-radius: 0.85rem;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  z-index: 30;
}

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

.notif-panel__header {
  padding: 0.8rem 1rem 0.6rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border-soft);
}

.notif-panel__list {
  display: flex;
  flex-direction: column;
  padding: 0.4rem;
}

.notif-panel__item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-radius: 0.6rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.2s ease;
}

.notif-panel__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.notif-panel__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  min-width: 0;
}

.notif-panel__item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.notif-panel__item.is-unread {
  background: rgba(124, 158, 255, 0.1);
}

.notif-panel__item.is-unread:hover {
  background: rgba(124, 158, 255, 0.16);
}

.notif-panel__text {
  font-size: 0.85rem;
  color: var(--text);
}

.notif-panel__snippet {
  font-size: 0.78rem;
  color: var(--muted-dim);
}

.notif-panel__empty {
  padding: 1.2rem 1rem;
  text-align: center;
  color: var(--muted-dim);
  font-size: 0.85rem;
}

.topbar__user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  cursor: pointer;
  box-shadow: 0 0 14px rgba(124, 158, 255, 0.2);
}

/* =========================================
   OVERLAY / MODAL
   ========================================= */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 12, 0.72);
  backdrop-filter: blur(6px);
  padding: 1.2rem;
}

.login-overlay.hidden {
  display: none;
}

.login-modal {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 780px;
  max-height: 92vh;
  border-radius: 1.1rem;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.login-modal__art {
  position: relative;
  background-size: cover;
  background-position: center 12%;
  background-image:
    linear-gradient(180deg, rgba(9, 12, 22, 0) 40%, rgba(9, 12, 22, 0.85) 100%),
    url('../../img/Karia2.webp?v=1');
  min-height: 100%;
}

.login-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(9, 12, 22, 0.55);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.login-modal__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.login-modal__panel {
  padding: 2rem 2.2rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.login-modal__badge {
  display: block;
  width: 100%;
  padding-bottom: 0.8rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
  background: none;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  font-style: italic;
  background-image: var(--aurora);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-modal__tabs {
  display: flex;
  gap: 0.3rem;
  padding: 0.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  margin-bottom: 1.4rem;
}

.login-modal__tab {
  flex: 1;
  padding: 0.55rem 0.8rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.login-modal__tab.is-active {
  background: var(--aurora);
  color: #0b0e1a;
}

.login-modal__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 1.3rem;
  color: var(--text);
  text-align: center; /* Centralizado conforme pedido */
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-form.hidden {
  display: none;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.login-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  font-family: var(--font-body);
}

.login-field input {
  padding: 0.7rem 0.9rem;
  border-radius: 0.7rem;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.92rem;
}

.login-field input::placeholder {
  color: var(--muted-dim);
}

.login-field input:focus {
  outline: none;
  border-color: rgba(124, 158, 255, 0.7);
}

.login-error {
  display: none;
  font-size: 0.82rem;
  color: var(--rose);
  font-family: var(--font-body);
  background: rgba(255, 143, 181, 0.1);
  border: 1px solid rgba(255, 143, 181, 0.3);
  border-radius: 0.6rem;
  padding: 0.6rem 0.8rem;
}

.login-error.is-visible {
  display: block;
}

.login-submit {
  margin-top: 0.3rem;
  width: 100%;
  padding: 0.8rem;
  border: none;
  border-radius: 999px;
  background: var(--aurora);
  color: #0b0e1a;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(124, 158, 255, 0.32);
}

.login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1.3rem 0;
  color: var(--muted-dim);
  font-size: 0.78rem;
  font-family: var(--font-body);
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-socials {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.login-social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem;
  border-radius: 0.7rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.login-social-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.login-modal__footer {
  margin-top: 1.4rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  font-family: var(--font-body);
}

.login-modal__footer a,
.login-switch {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: inherit;
}

.login-modal__footer a:hover,
.login-switch:hover {
  text-decoration: underline;
}

/* Menu simples do usuário logado */
.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 200px;
  padding: 0.5rem;
  border-radius: 0.85rem;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  z-index: 30;
}

.user-menu.hidden {
  display: none;
}

.user-menu__name {
  padding: 0.5rem 0.7rem 0.2rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.user-menu__email {
  padding: 0 0.7rem 0.5rem;
  font-size: 0.75rem;
  color: var(--muted-dim);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 0.3rem;
}

.user-menu__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-radius: 0.6rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.user-menu__item svg {
  flex-shrink: 0;
}

.user-menu__item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.user-menu__divider {
  height: 1px;
  margin: 0.3rem 0.2rem;
  background: var(--border-soft);
}

/* Item de perigo (ex.: Sair) — vermelho, igual ao padrão usado no dropdown do avatar */
.user-menu__item.is-danger {
  color: #ff8fb5;
}

.user-menu__item.is-danger:hover {
  background: rgba(255, 143, 181, 0.12);
  color: #ff8fb5;
}

/* =========================================
   Responsivo
   ========================================= */
@media (max-width: 720px) {
  .login-modal {
    grid-template-columns: 1fr;
  }
  .login-modal__art {
    display: none;
  }
  .login-modal__panel {
    padding: 1.6rem 1.4rem;
  }
}

@media (max-width: 560px) {
  .topbar__login-button span {
    display: none;
  }
  .topbar__login-button {
    padding: 8px 12px;
  }
}