/* ============================================================
   Navbar / Header — estilos da barra de navegação do site
   Depende das variáveis (--color-*, --radius-*, --speed, --shadow-*)
   definidas no :root do site.css, carregado antes deste arquivo.
   ============================================================ */

/* ------------------------------------------------------------
   Header / Navbar
   ------------------------------------------------------------ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 20px 0;
  transition: background-color var(--speed), box-shadow var(--speed), padding var(--speed);
}

.header--scrolled,
body.page-eventos .header,
body.page-evento .header {
  background: var(--color-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 0 var(--color-border), var(--shadow-sm);
  padding: 14px 0;
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.header__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Logo light mode */
.header__logo-img {
  height: 40px;
  width: auto;
  display: block;
  mix-blend-mode: multiply;
  transition: opacity var(--speed);
}

.header__logo-img:hover { opacity: 0.75; }

/* Logo dark mode — imagem alternativa */
.header__logo-img-dark {
  height: 40px;
  width: auto;
  display: none;
  transition: opacity var(--speed);
}

.header__logo-img-dark:hover { opacity: 0.75; }

[data-theme="dark"] .header__logo-img      { display: none;  }
[data-theme="dark"] .header__logo-img-dark { display: block; }

.header__nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-soft);
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  transition: color var(--speed), background-color var(--speed);
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-text);
  background: var(--color-primary-bg);
}

.nav-link.active {
  color: var(--color-primary-dk);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-soft);
  transition: all var(--speed);
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun  { display: none;  }

[data-theme="dark"] .theme-toggle .icon-moon { display: none;  }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }

.hamburger {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--color-text);
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: all var(--speed);
}

/* Hambúrguer aberto → X */
.hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; }
.hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Backdrop do drawer */
.mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 190;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--speed), visibility var(--speed);
}

.mobile-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* Drawer lateral (desliza da direita) */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(82vw, 360px);
  background: var(--color-bg);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.18));
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding: 18px 20px 28px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--speed);
}

.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.mobile-drawer__head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-drawer__user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-drawer__user .nav-user-name {
  font-size: 15px;
  font-weight: 700;
}

.mobile-drawer__brand .header__logo-img,
.mobile-drawer__brand .header__logo-img-dark { height: 32px; }

.mobile-drawer__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
}

.mobile-drawer__nav .nav-link {
  font-size: 17px;
  padding: 12px 10px;
  border-radius: var(--radius-xs);
}

.mobile-drawer__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.mobile-drawer__actions .btn { width: 100%; }

.mobile-drawer__cart {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  color: var(--color-text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--speed), color var(--speed);
}

.mobile-drawer__cart:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.mobile-drawer__logout {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--color-border);
  background: none;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: color var(--speed), border-color var(--speed);
}

.mobile-drawer__logout:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.mobile-menu__close {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: var(--radius-xs);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: var(--color-text);
  cursor: pointer;
}

/* ------------------------------------------------------------
   Menu de usuário (dropdown) + botão Eventos
   ------------------------------------------------------------ */
.nav-user-menu { position:relative }
.nav-user-btn {
  display:flex;align-items:center;gap:8px;
  background:none;border:1.5px solid var(--color-border);border-radius:100px;
  padding:4px 12px 4px 4px;cursor:pointer;color:var(--color-text);
  transition:background .2s,border-color .2s;font-family:inherit
}
.nav-user-btn:hover { background:var(--color-surface);border-color:var(--color-primary) }
.nav-user-avatar {
  width:28px;height:28px;border-radius:50%;
  background:var(--color-primary);color:#000;
  display:flex;align-items:center;justify-content:center;
  font-size:10px;font-weight:800;flex-shrink:0;letter-spacing:.5px
}
.nav-user-name { font-size:13px;font-weight:600;line-height:1 }
.nav-user-chevron { opacity:.5;transition:transform .2s }
.nav-user-menu.open .nav-user-chevron { transform:rotate(180deg) }
.nav-user-dropdown {
  position:absolute;top:calc(100% + 10px);right:0;
  background:var(--color-surface);border:1px solid var(--color-border);
  border-radius:12px;min-width:190px;padding:6px;
  box-shadow:0 8px 24px rgba(0,0,0,.18);
  opacity:0;visibility:hidden;transform:translateY(-6px);
  transition:opacity .15s,visibility .15s,transform .15s;
  z-index:200
}
.nav-user-menu.open .nav-user-dropdown { opacity:1;visibility:visible;transform:translateY(0) }
.nav-user-dropdown a,
.nav-user-dropdown button {
  display:flex;align-items:center;gap:10px;width:100%;
  padding:9px 10px;border-radius:7px;font-size:13px;font-weight:500;
  color:var(--color-text);text-decoration:none;background:none;border:none;
  cursor:pointer;transition:background .12s;font-family:inherit;text-align:left
}
.nav-user-dropdown a:hover,
.nav-user-dropdown button:hover { background:var(--color-primary-bg) }
.nav-user-dropdown .nav-dd-sep { height:1px;background:var(--color-border);margin:4px 0 }
.nav-user-dropdown .nav-dd-danger:hover { color:#ef4444;background:rgba(239,68,68,.08) }
.btn-eventos { position:relative;transition:transform .2s ease }
.nav-link.btn-eventos:hover {
  background:transparent;
  transform:scale(1.08)
}
.btn-eventos::after {
  content:'';position:absolute;inset:-3px;border-radius:14px;
  border:2px solid var(--color-primary);
  animation:eventos-pulse 2s ease-out infinite;opacity:0;pointer-events:none
}
@keyframes eventos-pulse {
  0%   { opacity:.4;transform:scale(1) }
  100% { opacity:0;transform:scale(1.08) }
}

/* ------------------------------------------------------------
   Botão do carrinho (navbar)
   ------------------------------------------------------------ */
.cart-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  color: var(--color-text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--speed);
  flex-shrink: 0;
}
.cart-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 100px;
  background: var(--color-primary);
  color: #080f1c;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  pointer-events: none;
  transition: transform .15s, opacity .15s;
}
.cart-badge[data-count="0"],
.cart-badge.hidden {
  opacity: 0;
  transform: scale(0);
}

/* ------------------------------------------------------------
   Responsivo — Tablet (769px – 1024px)
   ------------------------------------------------------------ */
@media (min-width: 769px) and (max-width: 1024px) {
  .header__inner { gap: 16px; }
  .header__nav { gap: 2px; }
  .nav-link { font-size: 13px; padding: 8px 10px; }
}

/* ------------------------------------------------------------
   Responsivo — Mobile (< 768px)
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  .header__nav { display: none; }
  .hamburger  { display: flex; }

  /* Theme toggle migra para dentro do drawer */
  .header__actions .theme-toggle { display: none; }

  /* Carrinho na barra só para usuário logado (visitante usa o drawer) */
  .header__actions--guest .cart-btn { display: none; }
}

/* ------------------------------------------------------------
   Responsivo — Telas muito estreitas (< 400px)
   ------------------------------------------------------------ */
@media (max-width: 400px) {
  .header__logo-img,
  .header__logo-img-dark { height: 32px; }

  .header__actions { gap: 4px; }

  /* Nome do usuário já aparece no drawer; na barra fica só o avatar */
  .header__actions .nav-user-name,
  .header__actions .nav-user-chevron { display: none; }

  .header__actions .nav-user-btn { padding: 4px; }
}
