/* ============================================
   SPHERE LIVE CHAT ENHANCEMENTS
   Emoji picker, mod tools, context menus
   ============================================ */

:root {
  --picker-bg: #242526;
  --picker-hover: #3a3b3c;
  --sphere-teal: #0891b2;
  --sphere-green: #06d6a0;
}

/* ============================================
   EMOJI PICKER
   ============================================ */

.emoji-picker {
  position: fixed;
  width: 320px;
  max-height: 400px;
  background: var(--picker-bg);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 10002;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.emoji-picker-header {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid #3e4042;
  overflow-x: auto;
  scrollbar-width: none;
}

.emoji-picker-header::-webkit-scrollbar {
  display: none;
}

.emoji-category-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.6);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.emoji-category-btn:hover {
  background: var(--picker-hover);
  color: rgba(255,255,255,0.9);
}

.emoji-category-btn.active {
  background: linear-gradient(135deg, var(--sphere-teal), var(--sphere-green));
  color: white;
}

.emoji-picker-body {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  align-content: start;
}

.emoji-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-btn:hover {
  background: var(--picker-hover);
  transform: scale(1.2);
}

.emoji-btn:active {
  transform: scale(1);
}

.emoji-picker-trigger {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.emoji-picker-trigger:hover {
  background: rgba(255,255,255,0.1);
  transform: scale(1.1);
}

/* ============================================
   MOD TOOLS PANEL
   ============================================ */

.mod-tools-panel {
  position: fixed;
  right: 20px;
  top: 80px;
  width: 320px;
  max-height: calc(100vh - 120px);
  background: var(--picker-bg);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mod-tools-header {
  padding: 16px;
  border-bottom: 1px solid #3e4042;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mod-tools-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: white;
}

.mod-tools-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--picker-hover);
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.mod-tools-close:hover {
  background: #4e4f50;
  transform: scale(1.05);
}

.mod-tools-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.mod-tool-section {
  margin-bottom: 24px;
}

.mod-tool-section h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}

.mod-tool-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.mod-tool-checkbox:hover {
  background: var(--picker-hover);
}

.mod-tool-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.mod-tool-checkbox span {
  color: rgba(255,255,255,0.9);
  font-size: 14px;
}

.mod-tool-btn {
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: linear-gradient(135deg, var(--sphere-teal), var(--sphere-green));
  color: white;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: all 0.2s;
}

.mod-tool-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.4);
}

.mod-tool-btn:active {
  transform: translateY(0);
}

#add-mod-username {
  width: 100%;
  padding: 10px 12px;
  background: var(--picker-hover);
  border: 1px solid #3e4042;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  margin-top: 8px;
}

#add-mod-username:focus {
  outline: none;
  border-color: var(--sphere-teal);
}

.mod-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--picker-hover);
  border-radius: 8px;
  margin-bottom: 8px;
}

.mod-list-item img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.mod-list-item span {
  flex: 1;
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  font-weight: 500;
}

.mod-remove-btn {
  padding: 4px 12px;
  background: #dc2626;
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.mod-remove-btn:hover {
  background: #b91c1c;
}

/* ============================================
   MESSAGE CONTEXT MENU
   ============================================ */

.message-context-menu {
  min-width: 180px;
  background: var(--picker-bg);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  padding: 6px;
  z-index: 10003;
}

.context-menu-item {
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
  display: block;
}

.context-menu-item:hover {
  background: var(--picker-hover);
}

.context-menu-item:active {
  background: #4e4f50;
}

/* ============================================
   MOD TOOLS BUTTON (in chat)
   ============================================ */

.mod-tools-toggle-btn {
  position: fixed;
  right: 20px;
  top: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sphere-teal), var(--sphere-green));
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(8, 145, 178, 0.4);
  z-index: 1000;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mod-tools-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(8, 145, 178, 0.6);
}

/* ============================================
   SLOW MODE INDICATOR
   ============================================ */

.slow-mode-indicator {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(220, 38, 38, 0.9);
  color: white;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.slow-mode-indicator svg {
  width: 14px;
  height: 14px;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .emoji-picker {
    width: calc(100vw - 40px);
    max-width: 320px;
    left: 50% !important;
    transform: translateX(-50%);
    bottom: 80px !important;
    top: auto !important;
  }

  .mod-tools-panel {
    right: 0;
    left: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
  }

  .message-context-menu {
    left: 50% !important;
    transform: translateX(-50%);
    bottom: 20px;
    top: auto !important;
  }
}
