/* In-match text chat (Trello: "Implement text chat improvements").
   Every chat style lives in this one file so it can be matched to the card's
   design attachment in one pass - the layout below is the game's Timber &
   Brass language (timber.css) standing in until then.

   Two channels, two text tones:
   - global: white.
   - team:   a pale sage green. Deliberately NOT a team colour - yellow and
             blue read very differently over the scene, so both sides get the
             same tone, and it is clear of the yellow/blue name colours and
             the brass used for system notices.
   Selectors are #chat-box-scoped so they outrank the shared iron text-field
   rule in index.html's inline <style>, which loads after this file. */

:root {
  --chat-global-text: #ffffff;
  --chat-team-text: #a8ecbf;
  --chat-team-edge: #5fae7c;
  --chat-system-text: #e2a24a;
  --chat-name-yellow: #f4d58a;
  --chat-name-blue: #9fc0ee;
  --chat-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 2px rgba(0, 0, 0, 0.8);
}

#chat-box {
  position: absolute;
  bottom: 120px;
  left: 30px;
  width: 380px;
  box-sizing: border-box;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 3px;
  font-family: var(--font-body);
}

#chat-messages {
  max-height: 150px;
  overflow-y: auto;
  margin-bottom: 8px;
}

/* A narrow brass slider on a recessed track, matching the in-game panels. */
#chat-messages::-webkit-scrollbar {
  width: 8px;
}
#chat-messages::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(143, 113, 72, 0.18);
}
#chat-messages::-webkit-scrollbar-thumb {
  min-height: 28px;
  background: linear-gradient(90deg, var(--tb-border, #4a3b2a), var(--tb-brass-dim, #8f7148));
  border: 1px solid var(--tb-border, #4a3b2a);
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(245, 216, 151, 0.25);
}
#chat-messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, var(--tb-brass-dim, #8f7148), var(--tb-brass, #e0a94d));
}
#chat-messages::-webkit-scrollbar-thumb:active {
  background: var(--tb-brass, #e0a94d);
}
#chat-messages::-webkit-scrollbar-button {
  display: none;
}

/* Firefox uses the standard scrollbar colours instead of pseudo-elements. */
@supports not selector(::-webkit-scrollbar) {
  #chat-messages {
    scrollbar-width: thin;
    scrollbar-color: var(--tb-brass-dim, #8f7148) rgba(0, 0, 0, 0.12);
  }
}

/* One line. Channel classes: .chat-line--global / --team / --system. */
.chat-message {
  padding: 2px 0;
  margin-bottom: 3px;
  font-size: 0.9rem;
  line-height: 1.3;
  color: var(--chat-global-text);
  text-shadow: var(--chat-shadow);
}
.chat-message.yellow strong { color: var(--chat-name-yellow); }
.chat-message.blue strong { color: var(--chat-name-blue); }
.chat-message.chat-line--team { color: var(--chat-team-text); }
.chat-message.chat-line--system { color: var(--chat-system-text); }

/* The channel tag at the head of each line: [ALL] / [TEAM]. Each tag wears
   its channel's text tone at full strength - [ALL] white like its line
   (Trello: it read grey), [TEAM] sage. */
.chat-tag {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  margin-right: 5px;
}
.chat-line--global .chat-tag { color: var(--chat-global-text); }
.chat-line--team .chat-tag { color: var(--chat-team-text); }

/* Input row: the channel indicator, then the field. Shown while open. */
#chat-entry {
  display: none;
  align-items: stretch;
  gap: 6px;
}
#chat-box.is-open #chat-entry { display: flex; }

#chat-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  padding: 0 10px;
  box-sizing: border-box;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--chat-global-text);
  background: linear-gradient(180deg, var(--tb-bg-1, #1e1812) 0%, var(--tb-bg-2, #16110d) 100%);
  border: 1.5px solid var(--tb-brass-dim, #8f7148);
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
  text-shadow: var(--chat-shadow);
}
#chat-mode[data-channel="team"] {
  color: var(--chat-team-text);
  border-color: var(--chat-team-edge);
  box-shadow: 0 0 10px rgba(95, 174, 124, 0.35);
}

#chat-box #chat-input {
  flex: 1 1 auto;
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--chat-global-text);
  display: none;
}
#chat-box.is-team #chat-input { color: var(--chat-team-text); border-color: var(--chat-team-edge); }
#chat-box.is-team #chat-input:focus { box-shadow: inset 0 2px 6px rgba(0,0,0,0.8), 0 0 10px rgba(95, 174, 124, 0.4); }

/* The J / K reminder under the row. */
#chat-hint {
  display: none;
  margin-top: 4px;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--tb-faint, #a89a82);
  text-shadow: var(--chat-shadow);
}
#chat-box.is-open #chat-hint { display: block; }
