/* ============================================================
   community.css — RepartoGiochi Community  (fix layout v2)
   Usa le variabili CSS definite in style.css
   ============================================================ */

/* Altezza header fissa del sito — allinea l’area community sotto l’header */
:root {
  --comm-header-h: 90px;
}
@media (max-width: 1024px) {
  :root {
    --comm-header-h: 70px;
  }
}
@media (max-width: 768px) {
  :root {
    --comm-header-h: 60px;
  }
}
@media (max-width: 480px) {
  :root {
    --comm-header-h: 55px;
  }
}

/* ── OVERRIDE LAYOUT PER PAGINA COMMUNITY ───────────────── */
/* La pagina community deve occupare TUTTA la viewport meno l'header,
   senza il padding-top extra di .layout e senza la scrollbar globale */

/* communityApp e loginGate: quando JS li mostra con display:flex, occupano tutto lo spazio */
#communityApp[style*="flex"],
#loginGate[style*="flex"] {
  flex: 1;
  min-width: 0;
  min-height: 0;
}

/* Scatta solo quando communityApp è visibile (JS rimuove display:none) */
body:has(#communityApp:not([style*="none"])) {
  overflow: hidden;
}

body:has(#communityApp:not([style*="none"])) #pageLayout {
  padding-top: 0;
  margin-top: var(--comm-header-h); /* mantiene il layout sotto l'header fisso */
  height: calc(100vh - var(--comm-header-h));
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: stretch;
}

/* Nav laterale: non fa overflow, resta compatta */
body:has(#communityApp:not([style*="none"])) .container-nav {
  flex-shrink: 0;
  overflow-y: auto;
}

body:has(#loginGate:not([style*="none"])) #pageLayout {
  padding-top: 0;
  margin-top: var(--comm-header-h);
  height: calc(100vh - var(--comm-header-h));
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: stretch;
}

/* Nasconde la nav laterale quando il gate è visibile (disabilitato per uniformità con le altre pagine)
body:has(#loginGate:not([style*="none"])) .container-nav {
  display: none;
}
*/

/* loginGate occupa tutto lo spazio rimanente */
#loginGate {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── LOGIN GATE ─────────────────────────────────────────── */
.comm-login-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  max-width: 480px;
  width: 100%;
}
.comm-gate-icon {
  font-size: 72px;
  margin-bottom: 24px;
  animation: floatIcon 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(99, 179, 255, 0.3));
}
@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
.comm-login-gate h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
}
.comm-login-gate p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}

/* ── BOTTONE PRIMARIO (usato nel gate e altrove) ─────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 32px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.4);
  letter-spacing: 0.01em;
  text-decoration: none;
  min-height: 48px;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.55);
  filter: brightness(1.1);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
  filter: brightness(0.95);
}

/* ── APP ROOT ────────────────────────────────────────────── */
#communityApp {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  overflow: hidden;
  height: 100%;
}

.comm-app {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: rgba(13, 21, 38, 0.97);
  backdrop-filter: blur(20px);
}

/* ── WORKSPACE RAIL ─────────────────────────────────────── */
.comm-rail {
  width: 62px;
  background: rgba(8, 13, 26, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 6px;
  border-right: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.comm-ws-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: all 0.2s;
  position: relative;
  flex-shrink: 0;
  border: none;
  background: rgba(31,41,55,0.8);
  color: var(--text-secondary);
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
}
.comm-ws-btn::before {
  content: '';
  position: absolute;
  left: -6px; top: 50%; transform: translateY(-50%);
  width: 4px; border-radius: 0 4px 4px 0;
  background: var(--secondary-color);
  transition: height 0.2s;
  height: 0;
}
.comm-ws-btn:hover, .comm-ws-btn.active { border-radius: 30%; }
.comm-ws-btn.active::before { height: 22px; }
.comm-ws-btn:hover::before  { height: 10px; }
.comm-ws-main {
  background: linear-gradient(135deg, var(--secondary-color), var(--gamming-accent));
  color: white;
  font-size: 10px;
  letter-spacing: 0.5px;
}
.comm-ws-btn:hover { background: var(--secondary-color); color: white; }
.comm-divider {
  width: 32px; height: 2px;
  background: rgba(255,255,255,0.06);
  border-radius: 1px;
  flex-shrink: 0;
}

/* ── CHANNEL SIDEBAR ─────────────────────────────────────── */
.comm-sidebar {
  width: 236px;
  background: rgba(13, 21, 38, 0.95);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
  min-height: 0;
  height: 100%;
}
.comm-ws-header {
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  cursor: default;
}
.comm-ws-name {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}
.comm-online-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

/* Tab Canali / Messaggi */
.comm-mode-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 10px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.comm-mode-tab {
  flex: 1;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: "Inter", system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  cursor: pointer;
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.45);
  transition: background 0.2s, color 0.2s;
}
.comm-mode-tab:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.07);
}
.comm-mode-tab.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(236, 72, 153, 0.2));
  color: var(--text-primary);
}

.comm-dm-item {
  padding: 10px 14px;
  margin: 2px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.comm-dm-item:hover {
  background: rgba(99, 102, 241, 0.12);
}
.comm-dm-item.active {
  background: rgba(99, 102, 241, 0.22);
}
.comm-dm-peer {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}
.comm-dm-preview {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comm-member-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.comm-dm-peer-btn {
  border: none;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.comm-dm-peer-btn:hover {
  background: rgba(99, 102, 241, 0.35);
}

.comm-ch-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(99,102,241,0.2) transparent;
  min-height: 0;
}
.comm-category-label {
  padding: 14px 14px 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.comm-category-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.3);
  flex: 1;
}
.comm-category-label:hover .comm-category-name { color: var(--text-secondary); }
.comm-ch-item {
  margin: 1px 6px;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background 0.1s;
  position: relative;
}
.comm-ch-item:hover  { background: rgba(99,102,241,0.12); }
.comm-ch-item.active { background: rgba(99,102,241,0.2); }
.comm-ch-icon {
  color: rgba(255,255,255,0.3);
  font-size: 14px;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
}
.comm-ch-item.active .comm-ch-icon { color: var(--secondary-color); }
.comm-ch-name {
  font-size: 13.5px;
  color: rgba(255,255,255,0.5);
  flex: 1;
  font-family: Inter, sans-serif;
}
.comm-ch-item.active .comm-ch-name,
.comm-ch-item:hover  .comm-ch-name { color: var(--text-primary); }
.comm-ch-badge {
  background: var(--accent-color);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
}
.comm-ch-unread::after {
  content: '';
  position: absolute;
  left: -5px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 8px;
  background: var(--text-primary);
  border-radius: 0 3px 3px 0;
}

/* USER PANEL */
.comm-user-panel {
  padding: 10px;
  background: rgba(0,0,0,0.3);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.comm-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary-color), var(--gamming-accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  position: relative;
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
}
.comm-status {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(13,21,38,0.95);
  position: absolute;
  bottom: 0; right: 0;
}
.comm-status.online { background: #10b981; }
.comm-user-info { flex: 1; min-width: 0; }
.comm-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.comm-user-status { font-size: 10px; color: rgba(255,255,255,0.3); }
.comm-user-actions { display: flex; gap: 2px; }
.comm-icon-btn {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
}
.comm-icon-btn:hover {
  background: rgba(99,102,241,0.15);
  color: var(--text-primary);
}

/* ── MAIN ────────────────────────────────────────────────── */
.comm-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: rgba(17,24,39,0.9);
}
.comm-topbar {
  height: 50px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  flex-shrink: 0;
}
.comm-topbar-icon {
  color: rgba(255,255,255,0.3);
  font-size: 18px;
  font-family: 'JetBrains Mono', monospace;
}
.comm-topbar-name {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}
.comm-topbar-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  border-left: 1px solid rgba(255,255,255,0.06);
  padding-left: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.comm-topbar-actions { margin-left: auto; display: flex; gap: 4px; }

.comm-content-wrap {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* ── THREAD LIST ─────────────────────────────────────────── */
.comm-thread-panel {
  width: 270px;
  border-right: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.comm-thread-header {
  padding: 12px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.comm-new-btn {
  background: var(--secondary-color);
  border: none;
  color: white;
  font-size: 18px;
  width: 22px; height: 22px;
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  transition: background 0.15s;
}
.comm-new-btn:hover { background: var(--gamming-accent); }
.comm-thread-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(99,102,241,0.2) transparent;
}
.comm-thread-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.1s;
  position: relative;
}
.comm-thread-item:hover  { background: rgba(99,102,241,0.08); }
.comm-thread-item.active { background: rgba(99,102,241,0.15); }
.comm-thread-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--secondary-color);
  border-radius: 0 2px 2px 0;
}
.comm-thread-badges { display: flex; gap: 4px; margin-bottom: 3px; }
.comm-pin-tag {
  font-size: 9px;
  background: rgba(245,158,11,0.12);
  color: #f59e0b;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}
.comm-new-tag {
  font-size: 9px;
  background: rgba(99,102,241,0.15);
  color: #818cf8;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}
.comm-thread-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  font-family: Inter, sans-serif;
}
.comm-thread-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.3);
}
.comm-thread-meta span:last-child {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
}
.comm-thread-preview {
  font-size: 11.5px;
  color: rgba(255,255,255,0.3);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── MESSAGES PANE ───────────────────────────────────────── */
.comm-messages-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}
.comm-ch-banner {
  padding: 20px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.comm-ch-banner-title {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.comm-ch-banner-desc { font-size: 13px; color: rgba(255,255,255,0.35); }
.comm-thread-view-header {
  padding: 12px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.comm-thread-view-title {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.comm-thread-view-meta { font-size: 11px; color: rgba(255,255,255,0.3); }

.comm-messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(99,102,241,0.2) transparent;
}
.comm-day-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: rgba(255,255,255,0.25);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
}
.comm-day-divider::before, .comm-day-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.06);
}
.comm-msg-group {
  padding: 4px 16px;
  display: flex;
  gap: 12px;
  transition: background 0.1s;
}
.comm-msg-group:hover { background: rgba(255,255,255,0.02); }
.comm-msg-avatar-col { flex-shrink: 0; padding-top: 2px; }
.comm-msg-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, var(--secondary-color), var(--gamming-accent));
  color: white;
}
.comm-msg-body { flex: 1; min-width: 0; }
.comm-msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.comm-msg-author {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: Inter, sans-serif;
}
.comm-msg-author.admin { color: var(--accent-color); }
.comm-msg-author.mod   { color: var(--gamming-accent); }
.comm-msg-role {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}
.comm-msg-role.admin { background: rgba(236,72,153,0.15); color: var(--accent-color); }
.comm-msg-role.mod   { background: rgba(167,139,250,0.15); color: var(--gamming-accent); }
.comm-msg-time {
  font-size: 10px;
  color: rgba(255,255,255,0.25);
  font-family: 'JetBrains Mono', monospace;
}
.comm-msg-content {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  font-family: Inter, sans-serif;
  word-break: break-word;
}
.comm-msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.comm-reaction {
  display: flex; align-items: center; gap: 4px;
  background: rgba(31,41,55,0.8);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.comm-reaction:hover { background: rgba(99,102,241,0.15); border-color: var(--secondary-color); }
.comm-reaction.mine  { background: rgba(99,102,241,0.15); border-color: var(--secondary-color); }
.comm-reaction-count { font-size: 11px; color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; }
.comm-msg-deleted { font-size: 13px; color: rgba(255,255,255,0.2); font-style: italic; }

/* ── INPUT AREA ──────────────────────────────────────────── */
.comm-input-area {
  padding: 10px 16px 14px;
  flex-shrink: 0;
  background: rgba(17,24,39,0.9);
  border-top: 1px solid rgba(255,255,255,0.05);
}
.comm-input-wrap {
  background: rgba(31,41,55,0.8);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  transition: border-color 0.2s;
}
.comm-input-wrap:focus-within {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.1);
}
.comm-input-emoji { color: rgba(255,255,255,0.3); font-size: 16px; }
.comm-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: Inter, sans-serif;
}
.comm-input::placeholder { color: rgba(255,255,255,0.25); }
.comm-send-btn {
  background: linear-gradient(135deg, var(--secondary-color), #7c3aed);
  border: none;
  border-radius: 7px;
  color: white;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  transition: all 0.2s;
  white-space: nowrap;
}
.comm-send-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.4); }
.comm-input-actions { display: flex; gap: 4px; }

/* ── MEMBER SIDEBAR ──────────────────────────────────────── */
.comm-members {
  width: 200px;
  background: rgba(13,21,38,0.95);
  border-left: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  transition: width 0.2s;
}
.comm-members.hidden { width: 0; }
.comm-members-header {
  padding: 12px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  white-space: nowrap;
  flex-shrink: 0;
}
.comm-online-count { color: #10b981; }
.comm-members-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(99,102,241,0.2) transparent;
}
.comm-role-label {
  padding: 10px 12px 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.25);
}
.comm-member-item {
  padding: 5px 8px;
  margin: 1px 4px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.1s;
  position: relative;
}
.comm-member-item:hover { background: rgba(99,102,241,0.12); }
.comm-member-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary-color), var(--gamming-accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  position: relative;
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
}
.comm-member-status {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 2px solid rgba(13,21,38,0.95);
  position: absolute;
  bottom: 0; right: 0;
}
.comm-member-status.online  { background: #10b981; }
.comm-member-status.idle    { background: #f59e0b; }
.comm-member-status.dnd     { background: #ef4444; }
.comm-member-status.offline { background: rgba(255,255,255,0.2); }
.comm-member-info { min-width: 0; flex: 1; }
.comm-member-name {
  font-size: 12.5px;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: Inter, sans-serif;
}
.comm-member-item:hover .comm-member-name { color: var(--text-primary); }
.comm-member-name.admin { color: var(--accent-color) !important; }
.comm-member-game {
  font-size: 10px;
  color: rgba(255,255,255,0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}



/* ── MODAL NUOVO THREAD ──────────────────────────────────── */
.comm-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
}
.comm-modal-overlay.active { display: flex; }
.comm-modal-box {
  background: #0d1525;
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 16px;
  width: 480px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.comm-modal-title {
  padding: 18px 20px 0;
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: var(--text-primary);
}
.comm-modal-body { padding: 16px 20px 20px; }
.comm-modal-field { margin-bottom: 14px; }
.comm-modal-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 6px;
  font-family: 'JetBrains Mono', monospace;
}
.comm-modal-field input,
.comm-modal-field textarea {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(99,102,241,0.18);
  border-radius: 9px;
  padding: 10px 13px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  font-family: Inter, sans-serif;
  transition: border-color 0.2s;
  resize: vertical;
  box-sizing: border-box;
}
.comm-modal-field input:focus,
.comm-modal-field textarea:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.1);
}
.comm-modal-msg { font-size: 12px; color: var(--accent-color); margin-bottom: 10px; min-height: 16px; }
.comm-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.comm-cancel-btn {
  padding: 9px 20px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: Inter, sans-serif;
}
.comm-cancel-btn:hover { background: rgba(255,255,255,0.1); }

/* ── UTILITY ─────────────────────────────────────────────── */
.comm-loading {
  padding: 20px 14px;
  color: rgba(255,255,255,0.25);
  font-size: 13px;
  font-family: Inter, sans-serif;
}
.comm-placeholder {
  padding: 30px 14px;
  color: rgba(255,255,255,0.2);
  font-size: 13px;
  text-align: center;
  font-family: Inter, sans-serif;
  line-height: 1.6;
}
.comm-error-msg {
  padding: 16px;
  color: #fca5a5;
  font-size: 13px;
  text-align: center;
}

/* ── SCROLLBAR ───────────────────────────────────────────── */
.comm-app ::-webkit-scrollbar { width: 4px; }
.comm-app ::-webkit-scrollbar-track { background: transparent; }
.comm-app ::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.2); border-radius: 2px; }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .comm-members { display: none; }
}
@media (max-width: 768px) {
  .comm-rail    { width: 52px; }
  .comm-sidebar { width: 200px; }
  .comm-thread-panel { width: 220px; }
}
@media (max-width: 600px) {
  .comm-sidebar { display: none; }
  .comm-thread-panel { width: 160px; }
}
@media (max-width: 440px) {
  .comm-thread-panel { display: none; }
}
