/* Alliance Chat — Spectator Styles */

/* ── Layout ─────────────────────────────────────────────────── */

.chat-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  min-height: 400px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .chat-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .chat-sidebar {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  .sidebar-section { min-width: 180px; }
}

/* ── Sidebar ────────────────────────────────────────────────── */

.chat-sidebar {
  background: var(--bg-secondary, #f1f5f9);
  border-radius: 12px;
  padding: 16px;
  overflow-y: auto;
  max-height: 500px;
}

.dark .chat-sidebar {
  background: #1e293b;
}

.sidebar-section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #64748b);
  margin: 0 0 8px 0;
}

.channel-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary, #334155);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
}

.channel-btn:hover { background: var(--bg-hover, #e2e8f0); }
.channel-btn.active { background: var(--accent, #3b82f6); color: white; }

.dark .channel-btn { color: #cbd5e1; }
.dark .channel-btn:hover { background: #334155; }
.dark .channel-btn.active { background: #3b82f6; }

/* ── Alliance Cards ─────────────────────────────────────────── */

.alliance-card {
  background: var(--bg-card, white);
  border-radius: 8px;
  border-left: 3px solid #3498db;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.alliance-card:hover {
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dark .alliance-card { background: #0f172a; }

.alliance-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.alliance-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  color: white;
}

.alliance-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.alliance-motto {
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  font-style: italic;
  margin-bottom: 4px;
}

.alliance-members {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.alliance-leader, .alliance-member {
  font-size: 0.75rem;
  color: var(--text-secondary, #475569);
}

.dark .alliance-leader, .dark .alliance-member { color: #94a3b8; }

.alliance-size {
  font-size: 0.7rem;
  color: var(--text-muted, #94a3b8);
  margin-top: 4px;
}

/* ── Chat Main ──────────────────────────────────────────────── */

.chat-main {
  background: var(--bg-card, white);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dark .chat-main { background: #0f172a; }

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.dark .chat-header { border-color: #334155; }

.chat-channel-label {
  font-weight: 700;
  font-size: 1rem;
}

.chat-refresh-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.chat-refresh-btn:hover { background: var(--bg-hover, #f1f5f9); }
.dark .chat-refresh-btn:hover { background: #1e293b; }

/* ── Messages ───────────────────────────────────────────────── */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 400px;
  min-height: 200px;
}

.chat-message {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.85rem;
  line-height: 1.4;
}

.chat-message.system {
  background: var(--bg-warning, #fef3c7);
  border-radius: 6px;
  padding: 6px 10px;
  margin: 4px 0;
}

.dark .chat-message.system { background: #422006; }

.chat-message.whisper {
  background: var(--bg-purple, #faf5ff);
  border-radius: 6px;
  padding: 4px 10px;
  border-left: 2px solid #a855f7;
}

.dark .chat-message.whisper { background: #2e1065; }

.chat-time {
  font-size: 0.7rem;
  color: var(--text-muted, #94a3b8);
  min-width: 45px;
  flex-shrink: 0;
}

.chat-sender {
  font-weight: 700;
  flex-shrink: 0;
}

.chat-system-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #f59e0b;
  flex-shrink: 0;
}

.chat-whisper-badge {
  font-size: 0.75rem;
  flex-shrink: 0;
}

.chat-content {
  color: var(--text-primary, #334155);
  word-break: break-word;
}

.dark .chat-content { color: #e2e8f0; }

.chat-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted, #94a3b8);
  font-size: 0.9rem;
}

/* ── Stats ──────────────────────────────────────────────────── */

.chat-stats-section {
  margin-top: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--bg-card, white);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.dark .stat-card { background: #1e293b; }

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent, #3b82f6);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.top-chatters {
  background: var(--bg-card, white);
  border-radius: 10px;
  padding: 16px;
}

.dark .top-chatters { background: #1e293b; }

.top-chatters h4 {
  margin: 0 0 10px 0;
  font-size: 0.9rem;
}

.chatter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border, #f1f5f9);
}

.dark .chatter-row { border-color: #334155; }

.chatter-rank {
  font-weight: 700;
  color: var(--text-muted, #94a3b8);
  min-width: 24px;
}

.chatter-name { flex: 1; font-weight: 500; }

.chatter-count {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
}
