/* ═══════════════════════════════════════════════════════
   Arena2026Digital — Live Chat Widget CSS
   Visitor widget + Admin inbox panel
═══════════════════════════════════════════════════════ */

/* ── Chat launcher button ─────────────────────────────── */
#chat-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1980;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #071407, #0d1e0d);
  border: 2px solid var(--gold, #d4a843);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  box-shadow: 0 4px 24px rgba(212,168,67,.35), 0 0 0 0 rgba(212,168,67,.4);
  transition: transform .25s var(--ease, cubic-bezier(.16,1,.3,1)), box-shadow .25s;
  animation: chatPulse 3s ease-in-out infinite;
}
@keyframes chatPulse {
  0%,100% { box-shadow: 0 4px 24px rgba(212,168,67,.35), 0 0 0 0 rgba(212,168,67,.25); }
  50%      { box-shadow: 0 4px 32px rgba(212,168,67,.5), 0 0 0 12px rgba(212,168,67,0); }
}
#chat-launcher:hover { transform: scale(1.1); animation: none; box-shadow: 0 8px 36px rgba(212,168,67,.55); }
#chat-launcher.open  { animation: none; border-color: #e74c3c; background: linear-gradient(135deg,#1a0404,#120303); }

.chat-launcher-icon { font-size: 1.6rem; transition: .2s; }
.chat-launcher-close{ font-size: 1.2rem; display: none; color: #e74c3c; }
#chat-launcher.open .chat-launcher-icon { display: none; }
#chat-launcher.open .chat-launcher-close{ display: block; }

/* Unread badge on launcher */
#chat-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 22px; height: 22px;
  background: #e74c3c;
  border-radius: 50%;
  font-family: var(--fh, 'DM Serif Display',Georgia,serif);
  font-size: .72rem;
  font-weight: 800;
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #020802;
  animation: badgePop .3s cubic-bezier(.34,1.56,.64,1);
}
#chat-badge.show { display: flex; }
@keyframes badgePop { from { transform: scale(0); } to { transform: scale(1); } }

/* ── Chat window ──────────────────────────────────────── */
#chat-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 1979;
  width: 360px;
  max-height: 520px;
  background: linear-gradient(165deg, #071407, #030903);
  border: 1px solid rgba(212,168,67,.3);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.8), 0 0 0 1px rgba(212,168,67,.08);
  transform: translateY(20px) scale(.95);
  opacity: 0;
  pointer-events: none;
  transition: transform .35s var(--ease, cubic-bezier(.16,1,.3,1)), opacity .3s;
}
#chat-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Window header */
.chat-hd {
  background: linear-gradient(135deg, #0d1e0d, #071407);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(212,168,67,.15);
  flex-shrink: 0;
}
.chat-avatar {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #0f280f, #d4a843);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  position: relative;
}
.chat-online-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  background: #2ecc71;
  border-radius: 50%;
  border: 2px solid #071407;
  animation: onlinePulse 2s ease-in-out infinite;
}
@keyframes onlinePulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.chat-hd-info { flex: 1; }
.chat-hd-name { font-family: var(--fh, 'DM Serif Display',Georgia,serif); font-size: .95rem; font-weight: 700; color: #f2ede0; }
.chat-hd-status { font-size: .72rem; color: #2ecc71; font-weight: 500; }

/* Minimise button */
.chat-min-btn {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  color: rgba(242,237,224,.5);
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  cursor: none; transition: .2s;
}
.chat-min-btn:hover { background: rgba(255,255,255,.1); color: #f2ede0; }

/* Pre-chat form */
#chat-prechat {
  padding: 20px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.prechat-intro { font-size: .88rem; color: rgba(242,237,224,.65); line-height: 1.6; }
.prechat-intro strong { color: #f2ede0; }
.chat-input-field {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  color: #f2ede0;
  padding: 10px 13px;
  font-size: .88rem;
  font-family: var(--fb, 'IBM Plex Sans','Helvetica Neue',Arial,sans-serif);
  outline: none;
  width: 100%;
  transition: .2s;
}
.chat-input-field:focus { border-color: rgba(212,168,67,.5); background: rgba(212,168,67,.025); }
.chat-start-btn {
  background: #d4a843;
  color: #020802;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-family: var(--fh, 'DM Serif Display',Georgia,serif);
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: none;
  transition: .2s;
  width: 100%;
}
.chat-start-btn:hover { background: #e8c060; }

/* Quick questions chips */
.chat-chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.chat-chip {
  background: rgba(212,168,67,.08);
  border: 1px solid rgba(212,168,67,.2);
  border-radius: 50px;
  color: #d4a843;
  font-size: .72rem;
  font-weight: 600;
  padding: 5px 12px;
  cursor: none;
  transition: .2s;
}
.chat-chip:hover { background: rgba(212,168,67,.16); border-color: rgba(212,168,67,.4); }

/* Messages area */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 0;
  display: none;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
#chat-messages.active { display: flex; }
#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-track { background: transparent; }
#chat-messages::-webkit-scrollbar-thumb { background: rgba(212,168,67,.2); border-radius: 2px; }

/* Message bubbles */
.chat-msg { display: flex; gap: 8px; max-width: 90%; }
.chat-msg.visitor { flex-direction: row-reverse; align-self: flex-end; }
.chat-msg.admin,.chat-msg.system { align-self: flex-start; }

.msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 800;
  flex-shrink: 0;
  margin-top: auto;
}
.msg-avatar.admin-av { background: linear-gradient(135deg, #0f280f, #d4a843); color: #020802; }
.msg-avatar.visitor-av { background: rgba(212,168,67,.15); color: #d4a843; }

.msg-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  font-size: .85rem;
  line-height: 1.5;
  word-break: break-word;
}
.chat-msg.visitor .msg-bubble { background: #d4a843; color: #020802; border-radius: 14px 14px 3px 14px; }
.chat-msg.admin  .msg-bubble  { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); color: #f2ede0; border-radius: 14px 14px 14px 3px; }
.chat-msg.system .msg-bubble  { background: rgba(212,168,67,.06); border: 1px solid rgba(212,168,67,.15); color: rgba(212,168,67,.8); border-radius: 10px; font-size: .78rem; font-style: italic; }

.msg-time { font-size: .62rem; color: rgba(242,237,224,.3); margin-top: 3px; display: block; }
.chat-msg.visitor .msg-time { text-align: right; }

/* Typing indicator */
.typing-indicator { align-self: flex-start; display: flex; gap: 8px; align-items: center; }
.typing-bubble { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 14px 14px 14px 3px; padding: 10px 14px; display: flex; gap: 4px; align-items: center; }
.typing-dot { width: 6px; height: 6px; background: rgba(242,237,224,.4); border-radius: 50%; animation: typingBounce .8s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce { 0%,80%,100%{transform:translateY(0)} 40%{transform:translateY(-6px)} }

/* Input row */
.chat-input-row {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: none;
  gap: 8px;
  align-items: flex-end;
  background: rgba(0,0,0,.2);
  flex-shrink: 0;
}
.chat-input-row.active { display: flex; }
#chat-text-input {
  flex: 1;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 10px;
  color: #f2ede0;
  padding: 9px 12px;
  font-size: .86rem;
  font-family: var(--fb, 'IBM Plex Sans','Helvetica Neue',Arial,sans-serif);
  outline: none;
  resize: none;
  max-height: 100px;
  min-height: 38px;
  line-height: 1.4;
  transition: .2s;
}
#chat-text-input:focus { border-color: rgba(212,168,67,.4); }
#chat-text-input::placeholder { color: rgba(242,237,224,.3); }
#chat-send-btn {
  width: 38px; height: 38px;
  background: #d4a843;
  border: none;
  border-radius: 10px;
  color: #020802;
  font-size: 1rem;
  cursor: none;
  transition: .2s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
#chat-send-btn:hover { background: #e8c060; transform: scale(1.05); }
#chat-send-btn:disabled { background: rgba(212,168,67,.3); cursor: not-allowed; }

/* Chat closed notice */
.chat-closed-bar {
  background: rgba(100,100,100,.15);
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 12px 16px;
  text-align: center;
  font-size: .78rem;
  color: rgba(242,237,224,.45);
  display: none;
  flex-shrink: 0;
}

/* Scroll to bottom button */
#chat-scroll-btn {
  position: absolute;
  bottom: 68px;
  right: 18px;
  width: 30px; height: 30px;
  background: #d4a843;
  border-radius: 50%;
  border: none;
  color: #020802;
  font-size: .9rem;
  cursor: none;
  display: none;
  align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  z-index: 2;
  transition: .2s;
}
#chat-scroll-btn.show { display: flex; }
#chat-scroll-btn:hover { transform: scale(1.1); }

/* ── Admin Chat Inbox (inside admin.php panel) ──────── */
.chat-inbox-wrap {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 560px;
  background: #0c160c;
  border: 1px solid rgba(255,255,255,.065);
  border-radius: 12px;
  overflow: hidden;
}
.chat-sessions-list {
  border-right: 1px solid rgba(255,255,255,.06);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.chat-sessions-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat-sessions-header h4 {
  font-family: var(--fh, 'DM Serif Display',Georgia,serif);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #d4a843;
}
.sessions-refresh-btn {
  background: rgba(212,168,67,.1);
  border: 1px solid rgba(212,168,67,.2);
  color: #d4a843;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: .68rem;
  font-weight: 600;
  cursor: pointer;
  transition: .2s;
}
.sessions-refresh-btn:hover { background: rgba(212,168,67,.2); }
.session-item {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  cursor: pointer;
  transition: .2s;
  position: relative;
}
.session-item:hover { background: rgba(255,255,255,.03); }
.session-item.active { background: rgba(212,168,67,.06); border-left: 3px solid #d4a843; }
.session-item .s-name { font-weight: 600; font-size: .85rem; color: #dce8dc; margin-bottom: 3px; }
.session-item .s-preview { font-size: .74rem; color: rgba(220,232,220,.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.session-item .s-time { font-size: .65rem; color: rgba(220,232,220,.3); position: absolute; top: 14px; right: 12px; }
.session-unread {
  position: absolute;
  bottom: 14px; right: 12px;
  background: #e74c3c;
  color: #fff;
  border-radius: 50px;
  min-width: 18px; height: 18px;
  font-size: .64rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}
.no-sessions-msg { padding: 32px 16px; text-align: center; color: rgba(220,232,220,.35); font-size: .84rem; }

/* Admin chat view */
.admin-chat-view {
  display: flex;
  flex-direction: column;
}
.admin-chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  background: rgba(0,0,0,.1);
}
.admin-chat-visitor { flex: 1; }
.admin-chat-visitor .v-name { font-family: var(--fh, 'DM Serif Display',Georgia,serif); font-size: .9rem; font-weight: 700; color: #dce8dc; }
.admin-chat-visitor .v-page { font-size: .72rem; color: rgba(220,232,220,.38); }
.admin-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-chat-messages::-webkit-scrollbar { width: 4px; }
.admin-chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 2px; }
.admin-msg { display: flex; gap: 8px; max-width: 85%; }
.admin-msg.visitor { flex-direction: row; align-self: flex-start; }
.admin-msg.admin   { flex-direction: row-reverse; align-self: flex-end; }
.admin-msg.system  { align-self: center; }
.admin-msg .abubble {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: .84rem;
  line-height: 1.5;
  word-break: break-word;
}
.admin-msg.visitor .abubble { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.09); color: #dce8dc; border-radius: 12px 12px 12px 3px; }
.admin-msg.admin   .abubble { background: #d4a843; color: #020802; border-radius: 12px 12px 3px 12px; }
.admin-msg.system  .abubble { background: rgba(212,168,67,.06); border: 1px solid rgba(212,168,67,.15); color: rgba(212,168,67,.7); border-radius: 8px; font-size: .76rem; font-style: italic; }
.amsg-time { font-size: .62rem; color: rgba(220,232,220,.28); margin-top: 3px; display: block; }
.admin-msg.admin .amsg-time { text-align: right; }

.admin-chat-input-row {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: rgba(0,0,0,.15);
  flex-shrink: 0;
}
#admin-chat-text {
  flex: 1;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 8px;
  color: #dce8dc;
  padding: 9px 12px;
  font-size: .84rem;
  font-family: var(--fb, 'IBM Plex Sans','Helvetica Neue',Arial,sans-serif);
  outline: none;
  resize: none;
  min-height: 38px;
  max-height: 90px;
}
#admin-chat-text:focus { border-color: rgba(212,168,67,.4); }
.admin-send-btn {
  background: #d4a843;
  border: none;
  border-radius: 8px;
  color: #020802;
  padding: 9px 16px;
  font-family: var(--fh, 'DM Serif Display',Georgia,serif);
  font-weight: 700;
  font-size: .78rem;
  cursor: pointer;
  transition: .2s;
  white-space: nowrap;
}
.admin-send-btn:hover { background: #e8c060; }
.admin-close-chat-btn {
  background: rgba(184,50,40,.12);
  border: 1px solid rgba(184,50,40,.25);
  color: #e74c3c;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: .2s;
}
.admin-close-chat-btn:hover { background: rgba(184,50,40,.25); }

.admin-no-chat {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: rgba(220,232,220,.3);
  font-size: .88rem;
}
.admin-no-chat .nc-icon { font-size: 3rem; }

/* Online status pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(46,204,113,.1);
  border: 1px solid rgba(46,204,113,.2);
  border-radius: 50px;
  padding: 3px 10px;
  font-size: .68rem;
  font-weight: 600;
  color: #2ecc71;
}
.status-pill .sp-dot { width: 6px; height: 6px; background: #2ecc71; border-radius: 50%; animation: onlinePulse 2s infinite; }

@media(max-width:768px) {
  #chat-window { width: calc(100vw - 32px); right: 16px; bottom: 92px; max-height: 70vh; }
  #chat-launcher { bottom: 20px; right: 16px; }
  .chat-inbox-wrap { grid-template-columns: 1fr; height: auto; }
  .chat-sessions-list { max-height: 200px; border-right: none; border-bottom: 1px solid rgba(255,255,255,.06); }
  .admin-chat-view { min-height: 360px; }
}
