/**
 * Unified chat UI: emoji dropdown + commands + input
 * Used on /chat, sports live chat, and global chat widget
 */
.chat-input-unified {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.chat-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Emoji dropdown: one button, popover with grid of emojis */
.chat-emoji-dropdown-wrap {
  position: relative;
}
.chat-emoji-trigger-unified {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.chat-emoji-trigger-unified:hover {
  background: rgba(255, 0, 255, 0.12);
  border-color: rgba(255, 0, 255, 0.3);
  color: #fff;
}
.chat-emoji-trigger-unified[aria-expanded="true"] {
  background: rgba(255, 0, 255, 0.15);
  border-color: rgba(255, 0, 255, 0.4);
}
.chat-emoji-trigger-icon {
  font-size: 1.15rem;
  line-height: 1;
}
.chat-emoji-trigger-arrow {
  font-size: 0.65rem;
  opacity: 0.8;
  transition: transform 0.2s ease;
}
.chat-emoji-trigger-unified[aria-expanded="true"] .chat-emoji-trigger-arrow {
  transform: rotate(180deg);
}
.chat-emoji-dropdown-unified {
  position: absolute;
  left: 0;
  top: auto;
  bottom: calc(100% + 6px);
  z-index: 1000;
  min-width: 200px;
  padding: 10px;
  background: rgba(18, 18, 24, 0.98);
  border: 1px solid rgba(255, 0, 255, 0.25);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.chat-emoji-dropdown-unified[hidden] {
  display: none !important;
}
.chat-emoji-dropdown-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.chat-emoji-btn-unified {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.chat-emoji-btn-unified:hover {
  background: rgba(255, 0, 255, 0.2);
  border-color: rgba(255, 0, 255, 0.35);
  transform: scale(1.1);
}
.chat-commands-btn-unified {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.chat-commands-btn-unified:hover {
  background: rgba(255, 0, 255, 0.12);
  color: #ff66ff;
  border-color: rgba(255, 0, 255, 0.3);
}
.chat-commands-panel-unified {
  position: relative;
  padding: 16px 20px;
  background: rgba(15, 15, 22, 0.98);
  border: 1px solid rgba(255, 0, 255, 0.25);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}
.chat-commands-panel-unified[hidden] {
  display: none !important;
}
.chat-commands-inner {
  position: relative;
}
.chat-commands-inner h4 {
  margin: 0 0 12px 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}
.chat-commands-inner ul {
  margin: 0;
  padding-left: 20px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  line-height: 1.7;
}
.chat-commands-inner code {
  background: rgba(255, 0, 255, 0.15);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.85em;
  color: #e879f9;
}
.chat-commands-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.25rem;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.chat-commands-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.chat-username-input-unified {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #fff;
  font-size: 0.95rem;
  width: 100%;
  box-sizing: border-box;
}
.chat-username-input-unified::placeholder {
  color: rgba(255, 255, 255, 0.45);
}
.chat-username-input-unified:focus {
  outline: none;
  border-color: rgba(255, 0, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 0, 255, 0.1);
}
/* Inline username (sports chat): single row Name | Message | Send */
.chat-input-row-with-username .chat-username-inline {
  width: 100px;
  min-width: 80px;
  flex-shrink: 0;
  padding: 10px 12px;
  font-size: 0.9rem;
}
.chat-input-row-unified {
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.chat-input-row-unified .chat-input-full {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: #fff;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.chat-input-row-unified .chat-input-full:focus {
  outline: none;
  border-color: rgba(255, 0, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 0, 255, 0.1);
}
.chat-input-row-unified .chat-input-full::placeholder {
  color: rgba(255, 255, 255, 0.4);
}
.chat-send-btn-unified {
  padding: 14px 28px;
  background: linear-gradient(135deg, #ff00ff, #c700c7);
  border: none;
  border-radius: 14px;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chat-send-btn-unified:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(255, 0, 255, 0.35);
}

@media (max-width: 768px) {
  .chat-emoji-btn-unified {
    width: 34px;
    height: 34px;
    font-size: 1.05rem;
  }
  .chat-emoji-dropdown-inner {
    grid-template-columns: repeat(5, 1fr);
  }
  .chat-input-row-with-username .chat-username-inline {
    width: 90px;
    min-width: 70px;
  }
  .chat-commands-btn-unified {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  .chat-input-row-unified .chat-input-full {
    padding: 12px 14px;
    font-size: 0.95rem;
  }
  .chat-send-btn-unified {
    padding: 12px 20px;
    font-size: 0.95rem;
  }
}
