/**
 * hz-sidebar.css — Shell do app do usuário (redesign 2026): sidebar + topbar + main.
 * Escopo isolado: só afeta o contexto /user (elementos .hz-app/.hz-sidebar/.hz-topbar,
 * que não existem no /admin). Usa os tokens --hz-* do redesign (hotzap-redesign.css).
 */

/* ═══════════════ LAYOUT BASE ═══════════════ */
body.hz-shell { margin: 0; }

.hz-app {
  min-height: 100vh;
  display: flex;
  color: var(--hz-text);
  background:
    radial-gradient(1100px 620px at 80% -8%, var(--hz-glow1), transparent 60%),
    radial-gradient(900px 520px at -6% 100%, var(--hz-glow2), transparent 55%),
    var(--hz-app-bg);
  font-family: var(--hz-font-display);
}

.hz-app__col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.hz-app__backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

/* ═══════════════ SIDEBAR ═══════════════ */
.hz-sidebar {
  width: 264px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--hz-sidebar);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--hz-border-soft);
  z-index: 60;
}

.hz-sidebar__brand {
  padding: 20px 22px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.hz-sidebar__logo { display: inline-flex; align-items: center; }
.hz-sidebar__logo img { height: 30px; width: auto; }

/* Botão recolher/expandir (rail) */
.hz-sidebar__collapse {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid var(--hz-border-soft);
  background: var(--hz-panel-2);
  color: var(--hz-text-dim);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 13px;
}
.hz-sidebar__collapse:hover { color: var(--hz-text); border-color: var(--hz-border-strong); }
.hz-ic-expand { display: none; }
@media (max-width: 1024px) { .hz-sidebar__collapse { display: none; } }

.hz-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hz-nav__group { display: flex; flex-direction: column; gap: 3px; }

.hz-nav__heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hz-text-faint);
  padding: 4px 12px 6px;
}

/* Item (link ou toggle de grupo colapsável) */
.hz-nav__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--hz-text-dim);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  width: 100%;
  background: none;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.hz-nav__link > span:first-of-type { flex: 1; }
.hz-nav__link > i:first-child { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }
.hz-nav__link:hover { background: var(--hz-panel-2); color: var(--hz-text); }

/* Ativo */
.hz-nav__link.is-active {
  font-weight: 700;
  color: var(--hz-text);
  background: linear-gradient(120deg, var(--hz-accent-soft), transparent);
  border-color: var(--hz-accent-border);
  box-shadow: inset 3px 0 0 -1px var(--hz-accent);
}
.hz-nav__link.is-active > i:first-child { color: var(--hz-accent); }

/* Caret dos colapsáveis */
.hz-nav__caret { font-size: 11px !important; width: auto !important; transition: transform 0.2s; color: var(--hz-text-faint); }
.hz-nav__item--collapsible.is-open > .hz-nav__toggle .hz-nav__caret { transform: rotate(180deg); }

/* Submenu (accordion) */
.hz-nav__sub { display: none; flex-direction: column; gap: 2px; padding: 3px 0 3px 12px; margin-left: 12px; border-left: 1px solid var(--hz-border-soft); }
.hz-nav__item--collapsible.is-open > .hz-nav__sub { display: flex; }

.hz-nav__sublink {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 12.75px;
  font-weight: 500;
  color: var(--hz-text-dim);
  text-decoration: none;
  cursor: pointer;
  border: none;
  width: 100%;
  background: none;
  font-family: inherit;
  text-align: left;
}
.hz-nav__sublink > span:first-of-type { flex: 1; }
.hz-nav__sublink > i:first-child { font-size: 14px; width: 16px; text-align: center; flex-shrink: 0; opacity: 0.85; }
.hz-nav__sublink:hover { background: var(--hz-panel-2); color: var(--hz-text); }
.hz-nav__sublink.is-active { color: var(--hz-accent); font-weight: 700; }

/* Badges/pills dentro da nav */
.hz-nav__badge {
  font-size: 10px; font-weight: 800; color: #fff; background: var(--hz-text-faint);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-grid; place-items: center;
}
.hz-nav__badge--danger { background: var(--hz-danger); }
.hz-nav__pill {
  font-size: 8.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--hz-violet); background: rgba(124, 92, 240, 0.15);
  padding: 2px 5px; border-radius: 5px;
}

/* Card de conta (rodapé) */
.hz-sidebar__account { padding: 14px; border-top: 1px solid var(--hz-border-soft); position: relative; }
.hz-account-card {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px; border-radius: 12px; cursor: pointer;
  background: var(--hz-panel-2); border: 1px solid var(--hz-border-soft);
  font-family: inherit; text-align: left;
}
.hz-account-card:hover { border-color: var(--hz-border-strong); }
.hz-account-card__avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #06110a;
  background: linear-gradient(140deg, var(--hz-accent), var(--hz-accent-deep));
}
.hz-account-card__info { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.hz-account-card__name { font-size: 12px; font-weight: 700; color: var(--hz-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hz-account-card__meta { font-size: 10.5px; color: var(--hz-text-faint); }
.hz-account-card__caret { font-size: 14px; color: var(--hz-text-faint); }

/* ═══════════════ TOPBAR ═══════════════ */
.hz-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 30px;
  background: var(--hz-panel);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--hz-border-soft);
}
.hz-topbar__spacer { flex: 1; }

.hz-topbar__btn {
  position: relative;
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 11px;
  border: 1px solid var(--hz-border-soft);
  background: var(--hz-panel-2);
  color: var(--hz-text);
  display: grid; place-items: center;
  cursor: pointer;
  font-size: 18px;
}
.hz-topbar__btn:hover { border-color: var(--hz-border-strong); color: var(--hz-text); }
.hz-topbar__hamburger { display: none; }

/* Ícones do toggle de tema: hotzap-theme.js alterna o display; default claro mostra o sol */
#hz-theme-toggle .icon-moon { display: none; }
#hz-theme-toggle > i { position: absolute; }

/* Sino de notificações */
.hz-topbar__bell { text-decoration: none; }
.hz-topbar__bell-badge {
  position: absolute; top: -3px; right: -3px;
  font-size: 10px; font-weight: 800; color: #fff; background: var(--hz-danger);
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  display: grid; place-items: center; border: 2px solid var(--hz-panel-solid);
}

/* Chip de conta */
.hz-topbar__account { position: relative; }
.hz-account-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px; border-radius: 12px;
  border: 1px solid var(--hz-border-soft); background: var(--hz-panel-2);
  cursor: pointer; font-family: inherit; color: var(--hz-text);
}
.hz-account-chip:hover { border-color: var(--hz-border-strong); }
.hz-account-chip__avatar {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #06110a;
  background: linear-gradient(140deg, var(--hz-accent), var(--hz-accent-deep));
}
.hz-account-chip__name { font-size: 12.5px; font-weight: 600; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Menu de conta (posicionamento; reusa .dropdown-menu/.dropdown-item existentes) */
.hz-account-menu {
  position: absolute;
  min-width: 240px;
  z-index: 1200;
}
.hz-topbar__account .hz-account-menu { right: 0; left: auto; top: calc(100% + 8px); bottom: auto; }
.hz-sidebar__account .hz-account-menu { left: 14px; right: 14px; top: auto; bottom: calc(100% + 6px); }

/* ═══════════════ MAIN / FOOTER ═══════════════ */
.hz-main {
  flex: 1;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 30px;
}

.hz-footer {
  text-align: center;
  padding: 20px 30px 24px;
  color: var(--hz-text-faint);
  font-size: 12px;
  line-height: 1.7;
}
.hz-footer a { color: var(--hz-accent); font-weight: 600; }

/* ═══════════════ RAIL — recolher no desktop ═══════════════
   Padrão = aberto. Ao recolher, a sidebar vira uma barra fina (só ícones);
   passar o mouse expande temporariamente (overlay, sem empurrar o conteúdo);
   clicar de novo no botão fixa aberto. Estado em localStorage (html.hz-rail). */
:root { --hz-rail: 76px; }

/* Troca do ícone do botão conforme o estado (independe do tamanho da tela) */
html.hz-rail .hz-ic-collapse { display: none; }
html.hz-rail .hz-ic-expand { display: inline-block; }

@media (min-width: 1025px) {
  html.hz-rail .hz-sidebar {
    position: fixed;
    top: 0; left: 0;
    z-index: 60;
    transition: width 0.2s ease;
  }
  /* Reserva a faixa fina para o conteúdo não deslocar quando a sidebar expande no hover */
  html.hz-rail .hz-app__col { margin-left: var(--hz-rail); transition: margin-left 0.2s ease; }

  /* Recolhido = quando NÃO está com o mouse em cima (o hover reverte pro normal) */
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) { width: var(--hz-rail); }
  html.hz-rail .hz-sidebar:hover,
  html.hz-rail .hz-sidebar:focus-within { box-shadow: 0 0 60px rgba(0, 0, 0, 0.35); }

  /* Esconde textos/labels/submenus no estado recolhido */
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-nav__heading,
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-nav__link > span:first-of-type,
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-nav__caret,
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-nav__pill,
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-nav__badge,
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-unread-badge,
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-nav__sub,
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-sidebar__logo,
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-account-card__info,
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-account-card__caret { display: none; }

  /* Centraliza ícones e ajusta paddings no recolhido */
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-nav { padding-left: 8px; padding-right: 8px; }
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-nav__link { justify-content: center; padding-left: 0; padding-right: 0; }
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-sidebar__brand { justify-content: center; padding-left: 0; padding-right: 0; }
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-sidebar__account { padding-left: 8px; padding-right: 8px; }
  html.hz-rail .hz-sidebar:not(:hover):not(:focus-within) .hz-account-card { justify-content: center; padding-left: 0; padding-right: 0; }
}

/* ═══════════════ RESPONSIVO ═══════════════ */
@media (max-width: 1024px) {
  .hz-sidebar {
    position: fixed;
    top: 0; left: 0;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    box-shadow: 0 0 70px rgba(0, 0, 0, 0.45);
  }
  .hz-sidebar.is-open { transform: none; }
  .hz-app__backdrop.is-open { display: block; }
  .hz-topbar__hamburger { display: grid; }
}

@media (max-width: 640px) {
  .hz-main { padding: 18px; }
  .hz-topbar { padding: 12px 16px; }
  .hz-account-chip__name { display: none; }
}
