/**
 * token-chat.css
 * Styles for the token chat room
 */

/* Chat panel container (right 1/3 of bottom panel) */
.chat-panel {
  width: 33.333%;
  min-width: 250px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

/* Chat header */
.chat-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.chat-header-label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chat-online-badge {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 10px;
  font-family: var(--font-mono);
}

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Empty state */
.chat-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.25);
  font-size: 11px;
  padding: 20px;
  font-style: italic;
}

/* Individual message */
.chat-message {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  opacity: 1;
  transition: opacity 0.3s;
}

.chat-message-new {
  animation: chatFadeIn 0.3s ease-out;
}

@keyframes chatFadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Avatar */
.chat-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(155, 89, 182, 0.2);
  color: rgba(155, 89, 182, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid rgba(155, 89, 182, 0.3);
}

/* Message content */
.chat-content {
  flex: 1;
  min-width: 0;
}

.chat-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 2px;
}

.chat-username-named {
  font-size: 11px;
  font-weight: 700;
  color: #9b59b6;
}

.chat-username-addr {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--font-mono);
}

.chat-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  font-family: var(--font-mono);
}

.chat-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  word-wrap: break-word;
  line-height: 1.4;
}

/* Input bar */
.chat-input-bar {
  padding: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.chat-input-wrapper {
  position: relative;
  width: 100%;
}

.chat-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  padding: 8px 36px 8px 10px;
  resize: none;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
  max-height: 80px;
  min-height: 34px;
  display: block;
}

.chat-input:focus {
  outline: none;
  border-color: rgba(155, 89, 182, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.chat-char-counter {
  position: absolute;
  bottom: 2px;
  right: 6px;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--font-mono);
  display: none;
  pointer-events: none;
}

.chat-send-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: #6c3fad;
  border: none;
  border-radius: 6px;
  color: white;
  padding: 0;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
  z-index: 2;
}

.chat-send-btn:hover {
  background: #7d4bc4;
}

.chat-send-btn:active {
  transform: translateY(-50%) scale(0.95);
  background: #5d3594;
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Mobile: hide chat by default unless shown by setMobileTab */
@media (max-width: 768px) {
  .chat-panel {
    width: 100% !important;
    min-width: unset !important;
    border-left: none !important;
  }
  
  /* When hidden class is applied, hide completely */
  /* thPanel's inline chat panel always hidden on mobile — CHAT tab uses #chat-panel overlay */
  #thPanel .chat-panel {
    display: none !important;
  }
  /* Standalone chat panel: hidden by default, shown by JS removing 'hidden' class */
  #chat-panel.hidden {
    display: none !important;
  }
  #chat-panel:not(.hidden) {
    display: flex !important;
    position: fixed !important;
    z-index: 210 !important; /* above ticker bar (201) and footer (200) */
    background: #0a0a0a !important;
    border-top: 1px solid #1e1e1e !important;
    overflow: hidden !important;
  }
  #chat-panel:not(.hidden) .chat-input-bar {
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
    flex-shrink: 0;
  }
}
