/* ===== BUNKER 0.2.0: casca (trilho de servidores, barra do servidor, voz conectada, usuário) =====
   Cores só pelas variáveis do topo de app.css. */

.app { grid-template-columns: 312px minmax(0, 1fr); }
.sidebar { flex-direction: row; padding: 0; background: var(--bg-side); }

/* Trilho com os ícones dos servidores */
.rail {
  width: 72px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 0; overflow-y: auto; scrollbar-width: none; background: var(--bg); border-right: 1px solid var(--line);
}
.rail::-webkit-scrollbar { display: none; }
.rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--line-2); flex: none; }
.rail-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 48px; height: 48px; border-radius: 24px; border: 0; padding: 0; cursor: pointer;
  background: var(--panel-2); color: var(--text); text-decoration: none; font-weight: 650; font-size: 15px;
  transition: border-radius .15s, background .15s, color .15s;
}
.rail-btn:hover, .rail-btn.active { border-radius: 16px; background: var(--accent); color: var(--accent-ink); }
.rail-btn.home { background: var(--panel); }
.rail-btn.home:hover, .rail-btn.home.active { background: var(--panel-3); }
.rail-btn.home .brand-mark { width: 30px; height: 30px; }
.rail-btn.add { background: var(--panel); color: var(--ok); }
.rail-btn.add:hover { background: var(--ok); color: var(--accent-ink); }
.rail-ini { overflow: hidden; white-space: nowrap; max-width: 40px; }
/* Marquinha à esquerda: branca no servidor aberto, bolinha quando tem coisa não lida */
.rail-btn.srv::before {
  content: ""; position: absolute; left: -12px; top: 50%; width: 4px; height: 0; border-radius: 0 4px 4px 0;
  background: var(--text); transform: translateY(-50%); transition: height .15s;
}
.rail-btn.srv.unread::before { height: 8px; }
.rail-btn.srv:hover::before { height: 20px; }
.rail-btn.srv.active::before { height: 40px; }
.rail-voice {
  position: absolute; right: -3px; bottom: -3px; display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; background: var(--ok); color: var(--accent-ink); box-shadow: 0 0 0 3px var(--bg);
}

/* Barra do servidor (canais) */
.side { width: 240px; flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.side-top {
  display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 14px; flex: none;
  border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; width: 100%;
}
.srv-head { cursor: pointer; }
.srv-head:hover { background: var(--hover-row); background: color-mix(in srgb, var(--panel-3) 50%, transparent); }
.side-title { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-menu { min-width: 200px; }

.chan-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 8px 12px; display: flex; flex-direction: column; gap: 1px; }
.cat { display: flex; flex-direction: column; gap: 1px; margin-top: 12px; }
.cat-head { display: flex; align-items: center; gap: 2px; padding-right: 2px; }
.cat-head.static { padding: 4px 6px; color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }
.cat-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; height: 26px; padding: 0 2px; border: 0; background: none; cursor: pointer;
  color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; text-align: left;
}
.cat-toggle span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-toggle:hover { color: var(--muted); }
.cat-add { width: 22px; height: 22px; color: var(--faint); }

.chan-link {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 8px;
  border-radius: var(--radius-sm); color: var(--faint); text-decoration: none; font-weight: 500;
}
.chan-link:hover { background: color-mix(in srgb, var(--panel-3) 60%, transparent); color: var(--muted); }
.chan-link.active { background: var(--active-bg); color: var(--text); font-weight: 600; }
.chan-link.unread { color: var(--text); font-weight: 650; }
.chan-link.in-call .chan-ico { color: var(--ok); }
.chan-ico { display: inline-flex; flex: none; }
.chan-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan-lock { display: inline-flex; color: var(--faint); }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text); flex: none; }
.chan-gear {
  display: none; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; flex: none;
  border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer;
}
.chan-gear:hover { color: var(--text); background: var(--panel-3); }
.chan-link:hover .chan-gear, .chan-link.active .chan-gear { display: inline-flex; }
@media (hover: none) { .chan-gear { display: none !important; } }
.srv-mini {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: none;
  border-radius: 8px; background: var(--panel-3); color: var(--text); font-size: 10px; font-weight: 700;
}

/* Quem está em cada canal de voz (embaixo do canal) */
.voice-people { display: flex; flex-direction: column; gap: 1px; margin: 0 0 4px 22px; }
.vp-row { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 6px; border-radius: 7px; color: var(--muted); cursor: pointer; }
.vp-row:hover { background: color-mix(in srgb, var(--panel-3) 60%, transparent); color: var(--text); }
.vp-row.speaking .rp-av { box-shadow: 0 0 0 2px var(--bg-side), 0 0 0 4px var(--ok), 0 0 12px rgba(52, 211, 153, .45); }
.vp-row.speaking .rp-name { color: var(--text); }
.vp-row .rp-name { font-size: 13px; }
.vp-row .rp-icons > span { gap: 0; align-items: flex-end; }

/* Voz conectada */
.voice-panel {
  display: flex; align-items: center; gap: 6px; margin: 0 8px; padding: 8px 6px 8px 10px; flex: none;
  border-top: 1px solid var(--line);
}
.vc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; text-decoration: none; line-height: 1.3; }
.vc-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.vc-status.ok { color: var(--ok); }
.vc-status.warn { color: var(--warn); }
.vc-status.bad { color: var(--bad); }
.vc-where { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vc-info:hover .vc-where { color: var(--text); text-decoration: underline; }
.vc-leave { color: var(--bad-text); }
.vc-leave:hover { background: var(--danger-soft); color: var(--bad-text); }

/* Painel do usuário */
.side .me { margin: 0 8px; padding: 8px 0 10px; gap: 2px; flex: none; }
.side .me-btn { padding: 4px; gap: 8px; }
.me-ctl.bad { color: var(--bad-text); }
.me-ctl.locked { opacity: .6; }
.side-empty { color: var(--faint); font-size: 13px; padding: 6px 8px; }

/* Botão de microfone travado (silenciado por um moderador) */
.ctl-btn.locked { position: relative; opacity: .7; }
.ctl-lock {
  position: absolute; right: -2px; top: -2px; display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; background: var(--warn); color: var(--accent-ink);
}

/* Ícones de servidor nos cartões do início e do convite */
.srv-card-ico {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700;
}
.srv-card-ico.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; background: transparent; }

/* Celular: a gaveta leva o trilho e a barra do servidor juntos */
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { width: 312px; max-width: 92vw; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .side { width: auto; }
  .rail { width: 64px; }
  .rail-btn { width: 44px; height: 44px; }
}

/* ===== Barra do servidor escondida (botão no cabeçalho do canal; só no computador) =====
   Some a coluna dos canais e das pessoas; o trilho com os servidores fica (72px + a borda). */
@media (min-width: 761px) {
  .side-collapsed .app { grid-template-columns: 73px minmax(0, 1fr); }
  .side-collapsed .side { display: none; }
}
@media (max-width: 760px) {
  .hide-mobile { display: none !important; }
}

/* ===== Chamar atenção ===== */
.nudge-bar {
  position: fixed; z-index: 130; top: 16px; /* por cima da borda acesa (.nudge-glow) */ left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 14px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--accent-line);
  box-shadow: var(--shadow-lg); color: var(--text); animation: nudge-in .25s ease-out;
}
.nudge-ico { display: inline-flex; color: var(--accent-text); transform-origin: 50% 10%; animation: nudge-ring .9s ease-in-out 2; }
.nudge-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; font-size: 13.5px; }
.nudge-msg { color: var(--muted); overflow-wrap: anywhere; }
@keyframes nudge-in { from { opacity: 0; transform: translate(-50%, -12px); } }
@keyframes nudge-ring {
  0%, 100% { transform: rotate(0); } 15% { transform: rotate(16deg); } 30% { transform: rotate(-14deg); }
  45% { transform: rotate(9deg); } 60% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); }
}
/* Destaque por dentro da janela: borda acesa; e uma tremida quando a janela não pôde tremer sozinha */
.nudge-glow::after {
  content: ""; position: fixed; inset: 0; z-index: 120; pointer-events: none;
  box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 48px color-mix(in srgb, var(--accent) 35%, transparent);
  animation: nudge-glow 1.3s ease-out forwards;
}
@keyframes nudge-glow { 0% { opacity: 0; } 12%, 70% { opacity: 1; } 100% { opacity: 0; } }
.nudge-shake .app { animation: nudge-shake .5s ease-in-out; }
@keyframes nudge-shake {
  0%, 100% { transform: translate(0, 0); } 10% { transform: translate(-10px, 3px); } 20% { transform: translate(10px, -3px); }
  30% { transform: translate(-8px, -2px); } 40% { transform: translate(8px, 2px); } 50% { transform: translate(-6px, 2px); }
  60% { transform: translate(6px, -2px); } 70% { transform: translate(-3px, 1px); } 80% { transform: translate(3px, -1px); }
}
@media (prefers-reduced-motion: reduce) {
  .nudge-shake .app, .nudge-ico { animation: none; }
}

/* ===== Amigos (Início) ===== */
/* Contador vermelho (pedidos de amizade esperando) */
.count-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--live); color: var(--accent-ink); font-size: 11px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; flex: none;
}
.rail-badge { position: absolute; right: -4px; bottom: -4px; box-shadow: 0 0 0 3px var(--bg); }
.home-link .chan-name { font-weight: 600; }
.home-link.active .chan-ico { color: var(--accent-text); }

.friends { flex: 1; height: 100%; display: flex; flex-direction: column; min-height: 0; }
.fr-top { gap: 12px; }
.fr-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; flex: none; }
.fr-title .ico { color: var(--muted); }
.fr-sep { width: 1px; height: 22px; background: var(--line-2); flex: none; }
.fr-tabs { display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.fr-tabs::-webkit-scrollbar { display: none; }
.fr-tab {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 7px; flex: none;
  background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap;
}
.fr-tab:hover { background: var(--panel-2); color: var(--text); }
.fr-tab.on { background: var(--active-bg); color: var(--text); }
.fr-tab.add { background: var(--accent); color: var(--accent-ink); }
.fr-tab.add:hover { background: var(--accent-hover); }
.fr-tab.add.on { background: transparent; color: var(--accent-text); }

.fr-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 24px 32px; }
.fr-list { display: flex; flex-direction: column; max-width: 860px; }
.fr-group { padding: 14px 8px 8px; color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }
.fr-group:first-child { padding-top: 0; }
.fr-row {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px; border-radius: 10px;
  border-top: 1px solid var(--line);
}
.fr-row:hover { background: var(--hover-row); background: color-mix(in srgb, var(--panel-3) 45%, transparent); border-top-color: transparent; }
.fr-row:hover + .fr-row { border-top-color: transparent; }
.fr-dot {
  position: absolute; right: -2px; bottom: -2px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--faint); box-shadow: 0 0 0 3px var(--bg);
}
.fr-dot.on { background: var(--ok); }
.fr-names { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.fr-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-user { margin-left: 6px; color: var(--faint); font-weight: 500; font-size: 13px; }
.fr-sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-acts { display: flex; align-items: center; gap: 6px; flex: none; }
.fr-act { width: 36px; height: 36px; border-radius: 50%; background: var(--panel-2); color: var(--muted); }
.fr-act:hover { background: var(--panel-3); color: var(--text); }
.fr-act.ok:hover { color: var(--ok); }
.fr-act.bad:hover { color: var(--bad-text); }

.fr-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 64px 16px; text-align: center; }
.fr-empty-ico {
  display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%;
  background: var(--panel-2); color: var(--faint);
}

.fr-add { max-width: 640px; display: flex; flex-direction: column; gap: 8px; }
.fr-add h2 { font-size: 18px; }
.fr-add-form { display: flex; gap: 8px; margin-top: 8px; }
.fr-add-form .input-prefix { flex: 1; min-width: 0; }
.fr-add-form .input-prefix .input { width: 100%; }
.fr-add-form.ok .input-prefix { border-color: var(--ok); }
.fr-add-form.bad .input-prefix { border-color: var(--danger-line); }
.fr-feedback { font-size: 13px; }
.fr-feedback.ok { color: var(--ok); }
.fr-feedback.bad { color: var(--bad-text); }

/* Itens de amizade no cartão e no menu da pessoa */
.fr-status { cursor: default; color: var(--muted); }
.fr-status:hover { background: transparent; }
.fr-status[data-friend="friends"] { color: var(--ok); }
.um-friends { display: flex; flex-direction: column; gap: 2px; }
.um-friends.sep { padding-top: 6px; border-top: 1px solid var(--line); }

@media (max-width: 760px) {
  .fr-top { gap: 8px; padding-right: 8px; }
  .fr-top .fr-title { display: none; }
  .fr-sep { display: none; }
  .fr-body { padding: 12px 12px 24px; }
  .fr-tab { padding: 0 8px; }
  .fr-tab.add { position: sticky; right: 0; }
  .fr-tab.add .fr-tab-label { display: none; }
  .fr-act { width: 34px; height: 34px; }
  .fr-add-form { flex-direction: column; }
}
