/*
 * Fase 0 do redesign — componentes compartilhados (sidebar, botão,
 * modal/overlay genérico, toast), hoje duplicados por copy-paste em
 * cada uma das 18 páginas com sidebar (extraído de
 * public/dashboard.html, confirmado idêntico por diff contra
 * contacts.html). Sem mudança visual nesta fase.
 *
 * IDs consultados por JS inline de cada página (não remover/renomear
 * sem atualizar os 18 arquivos): sidebarToggle, navGroupCampaign*,
 * navGroupLP*, navSectionAdmin, navAdminItem,
 * navConversationAnalysisItem, themeToggleBtn/Label/Tip,
 * shortcutsReopenBtn, tutorialVideoReopenBtn, notifBell, notifDot,
 * enableNativeNotifIconBtn.
 */

/* ---------- Sidebar ---------- */
.sidebar{
  position: fixed; top:0; left:0; bottom:0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display:flex; flex-direction:column;
  transition: width .2s ease;
  z-index: 40;
  overflow: hidden;
}
html.sidebar-collapsed .sidebar{ width: var(--sidebar-w-collapsed); }

.sidebar-logo{
  position:relative;
  height: var(--header-h); box-sizing:border-box;
  display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center;
  padding: 8px 12px; gap:8px; border-bottom:1px solid var(--border); flex-shrink:0;
}
.logo-mark{ width:32px; height:32px; color: var(--gold); flex-shrink:0; }
.logo-text{ display:flex; flex-direction:column; gap:3px; }
.logo-text .firm-name{ font-family:'Fraunces',serif; font-weight:700; font-size:12px; line-height:1.3; color:var(--gold); letter-spacing:.01em; }
.logo-text .firm-sub{ font-family:'Inter',sans-serif; font-weight:500; font-size:8px; letter-spacing:.15em; text-transform:uppercase; color:var(--text-faint); }
html.sidebar-collapsed .logo-text{ display:none; }
html.sidebar-collapsed .sidebar-logo{ padding: 20px 8px; }

.sidebar-toggle{
  position:absolute; top:20px; right:-14px;
  width:28px; height:28px; border-radius:50%;
  background:var(--gold); border:2px solid var(--bg); color:#1a1408;
  display:flex; align-items:center; justify-content:center; cursor:pointer; z-index:5;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  transition: transform .15s ease, filter .15s ease;
}
.sidebar-toggle:hover{ filter:brightness(1.08); transform: scale(1.08); }
.sidebar-toggle svg{ width:14px; height:14px; transition: transform .2s; }
html.sidebar-collapsed .sidebar-toggle svg{ transform: rotate(180deg); }

.sidebar-nav{ flex:1; overflow-y:auto; overflow-x:hidden; padding: 14px 10px; display:flex; flex-direction:column; gap:2px; }
.nav-section-label{
  font-size:10.5px; font-weight:600; letter-spacing:.06em; text-transform:uppercase;
  color: var(--text-faint); padding: 14px 12px 6px;
}
.nav-section:first-child .nav-section-label{ padding-top:2px; }
html.sidebar-collapsed .nav-section-label{ display:none; }
/* Seção "Admin" só é revelada após confirmar acesso via rede (whoami) —
   max-height + transition evita o "pulo" instantâneo do antigo
   display:none/hidden. */
#navSectionAdmin{ max-height:0; overflow:hidden; transition:max-height .25s ease; }
#navSectionAdmin.revealed{ max-height:300px; }
#navAdminItem, #navConversationAnalysisItem, #navBroadcastItem{
  max-height:0; overflow:hidden; padding-top:0; padding-bottom:0;
  transition: max-height .2s ease, padding .2s ease;
}
#navAdminItem.revealed, #navConversationAnalysisItem.revealed, #navBroadcastItem.revealed{
  max-height:44px; padding-top:10px; padding-bottom:10px;
}
.nav-item{
  position:relative;
  display:flex; align-items:center; gap:12px;
  padding: 10px 12px; border-radius:9px;
  color: var(--text-muted); text-decoration:none;
  font-size: 13px; white-space:nowrap;
  background: transparent; border:none; width:100%; text-align:left; cursor:pointer;
  font-family:'Inter',sans-serif;
  transition: background .15s, color .15s;
}
.nav-item:hover{ background: var(--surface-2); color: var(--text); }
.nav-item.active{ background: rgba(var(--gold-rgb),.12); color: var(--gold); }
.nav-icon{ display:inline-flex; flex-shrink:0; width:19px; height:19px; transition: transform .18s ease, color .18s ease; }
.nav-item:hover .nav-icon{ transform: scale(1.16); color: var(--gold); }
.nav-item.active .nav-icon{ color: var(--gold); }
.nav-label{ overflow:hidden; text-overflow:ellipsis; }
html.sidebar-collapsed .nav-label{ display:none; }
html.sidebar-collapsed .nav-item{ justify-content:center; padding:10px; }

.nav-tip{
  position:absolute; left: calc(100% + 10px); top:50%; transform:translateY(-50%) translateX(-4px);
  background: var(--surface-2); border:1px solid var(--border); color:var(--text);
  font-size:11.5px; padding:6px 10px; border-radius:6px; white-space:nowrap; opacity:0; pointer-events:none;
  transition: opacity .15s, transform .15s; z-index:50;
}
html.sidebar-collapsed .nav-item:hover .nav-tip{ opacity:1; transform:translateY(-50%) translateX(0); }
html:not(.sidebar-collapsed) .nav-tip{ display:none; }

/* Grupo com submenu (dropdown/acordeão) — ex: Campanha/Landing Page. */
.nav-group{ position:relative; }
.nav-group > .nav-item{ padding-right:34px; }
.nav-caret-btn{
  position:absolute; top:10px; right:6px; width:22px; height:22px; padding:0;
  display:flex; align-items:center; justify-content:center;
  background:transparent; border:none; color:var(--text-faint); cursor:pointer; border-radius:6px;
  transition: color .15s, background .15s;
}
.nav-caret-btn:hover{ background:var(--surface-2); color:var(--gold); }
.nav-caret-btn svg{ width:14px; height:14px; transition: transform .18s ease; }
.nav-group.open .nav-caret-btn svg{ transform: rotate(180deg); }
.nav-subitems{ display:none; flex-direction:column; }
.nav-group.open .nav-subitems{ display:flex; }
.nav-subitem{ padding-left:30px; font-size:12px; }
html.sidebar-collapsed .nav-caret-btn{ display:none; }
html.sidebar-collapsed .nav-group > .nav-item{ padding-right:10px; }
html.sidebar-collapsed .nav-subitems{ display:flex !important; }

.sidebar-bottom{ height: var(--footer-h); box-sizing:border-box; display:flex; align-items:center; border-top:1px solid var(--border); padding:0 10px; flex-shrink:0; gap:4px; }
.bell-btn{ position:relative; }
.notif-dot{
  position:absolute; top:6px; left:24px; min-width:15px; height:15px; padding:0 3px;
  border-radius:100px; background:var(--red); color:#fff; font-size:9px; font-weight:700;
  display:flex; align-items:center; justify-content:center; line-height:1;
}
html.sidebar-collapsed .notif-dot{ left:34px; top:4px; }
#enableNativeNotifIconBtn{
  background:none; border:none; padding:8px; border-radius:8px; cursor:pointer;
  color:var(--text-faint); display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
}
#enableNativeNotifIconBtn:hover{ background:var(--surface-2); color:var(--gold); }
#enableNativeNotifIconBtn svg{ width:18px; height:18px; }

.theme-toggle-item{ margin: 0 10px 8px; width: calc(100% - 20px); }

@media (max-width: 880px){
  .sidebar{ display:none; }
  #app{ margin-left:0 !important; }
  .credit-row{ left:0; }
}

/* ---------- Botão / modal / overlay / toast genéricos ---------- */
.btn{
  background: var(--gold); color: #1a1408; border: none; border-radius: 9px;
  padding: 8px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.btn:hover{ filter: brightness(1.08); }
.btn.secondary{ background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover{ border-color: var(--gold-dim); color: var(--gold); filter:none; }

.overlay{
  position: fixed; inset: 0; background: rgba(10,8,5,.6);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.overlay.open{ display: flex; }
.modal{
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; width: 100%; max-width: 340px; text-align: center;
}
.modal h3{ font-family: 'Fraunces', serif; font-weight: 600; font-size: 15px; margin: 0 0 14px; }
.modal-actions{ display:flex; justify-content: center; gap: 8px; margin-top: 16px; }

.toast-stack{ position:fixed; bottom:22px; right:22px; display:flex; flex-direction:column; gap:10px; z-index:100; max-width:340px; }
.toast{
  background: var(--surface-2); border:1px solid var(--border); border-left:3px solid var(--gold-dim);
  color:var(--text); padding:12px 16px; border-radius:9px; font-size:12.5px; line-height:1.5;
  box-shadow:0 10px 28px rgba(0,0,0,.4); animation: toast-in .25s ease; transition: opacity .2s, transform .2s;
}
.toast.success{ border-left-color: var(--green); }
.toast.error{ border-left-color: var(--red); }
.toast.clickable{ cursor:pointer; }
.toast.clickable:hover{ filter: brightness(1.15); }
@keyframes toast-in{ from{ opacity:0; transform:translateY(10px); } to{ opacity:1; transform:none; } }

/* ---------- Modal "Atalhos e recursos" ---------- */
.shortcuts-modal .modal{ max-width: 560px; }
.shortcuts-section{ margin-bottom: 18px; }
.shortcuts-section:last-of-type{ margin-bottom: 10px; }
.shortcuts-section-label{
  font-size: 10.5px; font-weight:600; text-transform:uppercase; letter-spacing:.06em;
  color: var(--gold-on-light, var(--gold)); margin-bottom: 10px;
}
.shortcuts-list{ display:flex; flex-direction:column; gap: 10px; }
.shortcuts-item{ display:flex; gap: 10px; align-items:flex-start; }
.shortcuts-item-icon{
  width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border);
  display:flex; align-items:center; justify-content:center; flex-shrink:0; color: var(--gold);
}
.shortcuts-item-icon svg{ width: 15px; height: 15px; }
.shortcuts-item-body{ min-width:0; }
.shortcuts-item-title{ font-size: 12.5px; font-weight:600; color: var(--text); margin-bottom: 2px; }
.shortcuts-item-desc{ font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.shortcuts-footer-check{
  display:flex; align-items:center; gap: 8px; font-size: 12px; color: var(--text-muted);
  padding-top: 14px; border-top: 1px solid var(--border); margin-top: 4px;
}

/* ---------- Modal "Vídeo de onboarding" ---------- */
.tutorial-video-modal .modal{ max-width: 720px; }
.tutorial-video-modal video{
  width: 100%; display: block; border-radius: 8px; background: #000;
  border: 1px solid var(--border);
}
.tutorial-video-desc{ font-size: 12.5px; color: var(--text-muted); line-height: 1.5; margin-bottom: 14px; }
