/* ============================================
   BONFIRE CHAT - Багаття
   ============================================ */

/* Overlay */
.bonfire-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(10px);
  display: flex;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s, visibility 0.3s;
}
.bonfire-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Main layout */
.bonfire-layout {
  display: flex;
  width: 100%;
  height: 100%;
  padding: 24px;
  justify-content: center;
}

/* Chat area */
.bonfire-chat {
  flex: 1;
  max-width: 900px;
  background: linear-gradient(180deg, var(--bgColorMainAside) 0%, var(--bgColorMainBlack) 100%);
  border: 1px solid rgba(224,175,76,0.12);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(224,175,76,0.06), 0 20px 60px rgba(0,0,0,0.5);
}

/* Header */
.bonfire-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(224,175,76,0.1);
  background: linear-gradient(135deg, rgba(224,175,76,0.06), transparent);
}
.bonfire-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.bonfire-header-icon {
  width: 36px;
  height: 36px;
}
.bonfire-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--colorWhite);
  margin: 0;
  line-height: 1.2;
}
.bonfire-online-count {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}
.bonfire-close {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.bonfire-close:hover {
  background: rgba(255,255,255,0.08);
  color: var(--colorWhite);
}

/* Messages area */
.bonfire-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(224,175,76,0.15) transparent;
}
.bonfire-messages::-webkit-scrollbar { width: 4px; }
.bonfire-messages::-webkit-scrollbar-thumb { background: rgba(224,175,76,0.2); border-radius: 4px; }

/* Single message */
.bonfire-msg {
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  transition: background 0.15s;
  animation: bonfireFadeIn 0.3s;
}
.bonfire-msg:hover {
  background: rgba(255,255,255,0.03);
}
@keyframes bonfireFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Message avatar */
.bonfire-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--colorSrvdl));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--bgColorMainAside);
  overflow: hidden;
}
.bonfire-msg-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
}

/* Message body */
.bonfire-msg-body { flex: 1; min-width: 0; }
.bonfire-msg-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.bonfire-msg-name { font-size: 13px; font-weight: 600; color: var(--accent); }
.bonfire-msg-time { font-size: 11px; color: rgba(255,255,255,0.2); }
.bonfire-msg-text { font-size: 14px; color: rgba(255,255,255,0.8); line-height: 1.5; word-break: break-word; }
.bonfire-msg-link { color: var(--accent, #e0af4c); text-decoration: underline; text-underline-offset: 2px; transition: opacity 0.2s; }
.bonfire-msg-link:hover { opacity: 0.8; }
.bonfire-msg-delete { background: none; border: none; color: rgba(255,255,255,0.15); cursor: pointer; font-size: 12px; padding: 0 2px; margin-left: auto; transition: color 0.2s; line-height: 1; }
.bonfire-msg-delete:hover { color: var(--colorRed); }

/* System message (join/leave) */
.bonfire-msg-system {
  text-align: center;
  padding: 6px 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.2);
  animation: bonfireFadeIn 0.3s;
}
.bonfire-msg-system span {
  color: var(--accent);
  font-weight: 500;
}

/* Input area */
.bonfire-input-area {
  padding: 16px 24px 20px;
  border-top: 1px solid rgba(224,175,76,0.1);
  background: rgba(0,0,0,0.2);
}
.bonfire-input-wrap { display: flex; gap: 10px; align-items: center; }
.bonfire-input-field {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.bonfire-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px 60px 12px 16px;
  color: var(--colorWhite);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.bonfire-input:focus { border-color: rgba(224,175,76,0.3); }
.bonfire-input::placeholder { color: rgba(255,255,255,0.25); }
.bonfire-char-counter {
  position: absolute;
  right: 12px;
  font-size: 11px;
  color: rgba(255,255,255,0.15);
  pointer-events: none;
  transition: color 0.2s;
}
.bonfire-char-counter.warn { color: rgba(239,68,68,0.5); }
.bonfire-send {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--colorSrvdl));
  color: var(--bgColorMainAside);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.bonfire-send:hover { transform: scale(1.05); box-shadow: 0 0 16px rgba(224,175,76,0.3); }
.bonfire-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.bonfire-send.bonfire-cooldown { opacity: 0.4; pointer-events: none; }
.bonfire-auth-required { text-align: center; padding: 8px 0; font-size: 14px; color: rgba(255,255,255,0.4); }
.bonfire-auth-required a { color: var(--accent); text-decoration: none; }
.bonfire-auth-required a:hover { text-decoration: underline; }

/* Loading */
.bonfire-loading { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 40px; }
.bonfire-ember {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: bonfireGlow 1s ease-in-out infinite;
}
.bonfire-ember:nth-child(2) { animation-delay: 0.2s; }
.bonfire-ember:nth-child(3) { animation-delay: 0.4s; }
@keyframes bonfireGlow {
  0%,100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}
.bonfire-empty { text-align: center; padding: 60px 20px; color: rgba(255,255,255,0.25); font-size: 14px; }

/* Responsive */
@media (max-width: 768px) {
  .bonfire-layout { padding: 0; }
  .bonfire-chat { border-radius: 0; max-width: 100%; }
}

/* ── Back button ── */
.bonfire-back {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.bonfire-back:hover {
  background: rgba(255,255,255,0.08);
  color: var(--colorWhite);
}

/* ── Clickable nicknames ── */
a.bonfire-msg-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}
a.bonfire-msg-name:hover { color: var(--accentlite); text-decoration: underline; }
a.bonfire-msg-avatar { display: flex; align-items: center; justify-content: center; text-decoration: none; flex-shrink: 0; }

/* ── Auth gate ── */
.bonfire-auth-gate {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bonfire-auth-gate-content {
  text-align: center;
  padding: 40px;
}
.bonfire-auth-gate-text {
  font-size: 16px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 24px;
}
.bonfire-auth-gate-btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.bonfire-auth-gate-btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  background: linear-gradient(135deg, var(--accent), var(--colorSrvdl));
  color: var(--bgColorMainAside);
}
.bonfire-auth-gate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(224,175,76,0.25);
}
.bonfire-auth-gate-btn--secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--colorWhite);
}
.bonfire-auth-gate-btn--secondary:hover {
  background: rgba(255,255,255,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* ── Lobby ── */
.bonfire-lobby {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.bonfire-lobby-title {
  text-align: center;
  font-size: 14px;
  color: rgba(255,255,255,0.35);
  padding-bottom: 8px;
}

/* ── Room cards ── */
.bonfire-rooms {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bonfire-room-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid rgba(224,175,76,0.1);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: all 0.25s;
}
.bonfire-room-card:hover {
  background: rgba(224,175,76,0.06);
  border-color: rgba(224,175,76,0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.bonfire-room-card.bonfire-room-full {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.bonfire-room-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(224,175,76,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.bonfire-room-info {
  flex: 1;
  min-width: 0;
}
.bonfire-room-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--colorWhite);
  margin-bottom: 3px;
}
.bonfire-room-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  line-height: 1.3;
}
.bonfire-room-count {
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}
.bonfire-room-online {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}
.bonfire-room-max {
  font-size: 12px;
  color: rgba(255,255,255,0.25);
}

@media (max-width: 480px) {
  .bonfire-lobby { padding: 16px; }
  .bonfire-room-card { padding: 14px 16px; gap: 12px; }
  .bonfire-room-icon { width: 40px; height: 40px; font-size: 20px; }
  .bonfire-room-name { font-size: 14px; }
  .bonfire-room-count { padding: 6px 10px; }
  .bonfire-room-online { font-size: 16px; }
}
