/**
 * Gameks Chatbot & Voice Assistant Styles
 * Modern cyberpunk design with neon accents
 */

:root {
  --chatbot-opacity: 1;
}

/* ========== CHATBOT CONTAINER ========== */
.chatbot-container {
  position: fixed;
  bottom: 170px;
  /* Above the toggle button */
  right: 30px;
  width: 380px;
  height: 600px;
  background: linear-gradient(135deg, rgba(26, 26, 46, var(--chatbot-opacity)) 0%, rgba(22, 33, 62, var(--chatbot-opacity)) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 235, 59, 0.2);
  display: none;
  flex-direction: column;
  z-index: 9999;
  border: 1px solid rgba(255, 235, 59, 0.3);
  overflow: hidden;
}

.chatbot-container.active {
  display: flex;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ========== HEADER ========== */
.chatbot-header {
  background: rgba(0, 0, 0, var(--chatbot-opacity));
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-bottom: 2px solid rgba(255, 235, 59, 0.3);
}

.chatbot-avatar {
  width: 45px;
  height: 45px;
  background: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(255, 235, 59, 0.2);
}

.chatbot-info {
  flex: 1;
}

.chatbot-info h4 {
  margin: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}

.chatbot-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #ffeb3b;
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.chatbot-minimize,
.chatbot-reset,
.chatbot-opacity,
.chatbot-clear,
.chatbot-mute {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-minimize:hover,
.chatbot-reset:hover,
.chatbot-opacity:hover,
.chatbot-clear:hover,
.chatbot-mute:hover {
  background: rgba(0, 0, 0, 0.3);
  transform: scale(1.1);
}

/* ========== LANGUAGE SELECTOR ========== */
.chatbot-language {
  display: flex;
  gap: 5px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lang-btn {
  flex: 1;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.lang-btn.active {
  background: linear-gradient(135deg, #ffeb3b, #ffd700);
  color: #000;
  border-color: #ffeb3b;
  font-weight: 600;
}

/* ========== MESSAGES ========== */
.chatbot-messages {
  flex: 1;
  min-height: 0;
  /* Crucial for flex scrolling */
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: rgba(10, 10, 10, var(--chatbot-opacity));
  position: relative;
  z-index: 1;
}

.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 235, 59, 0.3);
  border-radius: 3px;
}

.message {
  display: flex;
  gap: 10px;
  animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
  from {
    transform: translateY(10px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.message-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.bot-message .message-avatar {
  background: #000;
  border: 1px solid rgba(255, 235, 59, 0.3);
  overflow: hidden;
}

.user-message {
  flex-direction: row-reverse;
}

.user-message .message-avatar {
  background: linear-gradient(135deg, #bc13fe, #8b5cf6);
}

.message-content {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 15px;
  border-radius: 15px;
  max-width: 70%;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-message .message-content {
  background: linear-gradient(135deg, #bc13fe, #8b5cf6);
  border: none;
}

.message-content p {
  margin: 0;
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

/* Quick Replies */
.quick-replies {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.quick-replies button {
  background: rgba(255, 235, 59, 0.1);
  border: 1px solid rgba(255, 235, 59, 0.3);
  color: #ffeb3b;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  transition: all 0.3s;
}

.quick-replies button:hover {
  background: rgba(255, 235, 59, 0.2);
  border-color: #ffeb3b;
  transform: translateX(5px);
}

/* Game Cards */
.game-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.mini-game-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.mini-game-card img {
  width: 40px;
  height: 40px;
  border-radius: 5px;
  object-fit: cover;
}

.mini-game-card span {
  font-size: 12px;
  color: #fff;
}

/* Typing Indicator */
.typing-indicator .message-content {
  padding: 15px;
}

.typing-dots {
  display: flex;
  gap: 5px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: #ffeb3b;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }

  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* ========== CHATBOT FOOTER ========== */
.chatbot-footer {
  background: rgba(26, 26, 46, var(--chatbot-opacity));
  border-top: 1px solid rgba(255, 235, 59, 0.2);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
  box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.3);
}

/* ========== VOICE CONTROLS TOGGLE ========== */
.voice-controls-header {
  padding: 8px 15px;
  background: rgba(0, 0, 0, 0.2);
}

.voice-toggle-btn {
  width: 100%;
  padding: 6px;
  background: transparent;
  border: 1px solid rgba(255, 235, 59, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.voice-toggle-btn:hover {
  background: rgba(255, 235, 59, 0.05);
  border-color: rgba(255, 235, 59, 0.3);
  color: #ffeb3b;
}

.voice-toggle-btn i {
  font-size: 10px;
  transition: transform 0.3s;
}

/* ========== VOICE CONTROLS ========== */
.voice-controls {
  display: flex;
  gap: 8px;
  padding: 10px 15px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 235, 59, 0.1);
}

.voice-btn {
  flex: 1;
  padding: 10px;
  background: linear-gradient(135deg, #ffeb3b, #ffd700);
  border: none;
  border-radius: 8px;
  color: #000;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
}

.voice-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 235, 59, 0.3);
}

.voice-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.voice-btn.listening {
  background: linear-gradient(135deg, #ff0077, #ff4499);
  animation: pulse-glow 1.5s infinite;
}

.voice-btn.speaking {
  background: linear-gradient(135deg, #bc13fe, #8b5cf6);
  animation: wave 1s infinite;
}

@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 0 10px rgba(255, 0, 119, 0.5);
  }

  50% {
    box-shadow: 0 0 30px rgba(255, 0, 119, 0.8);
  }
}

@keyframes wave {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

/* ========== CONTINUOUS VOICE MODE ========== */
.continuous-voice-section {
  padding: 12px 15px;
  background: rgba(188, 19, 254, 0.08);
  border-top: 1px solid rgba(188, 19, 254, 0.2);
  text-align: center;
}

.continuous-voice-btn {
  width: 100%;
  max-width: 240px;
  margin: 0 auto;
  padding: 8px 15px;
  background: linear-gradient(135deg, #bc13fe, #8b5cf6);
  border: none;
  border-radius: 20px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.continuous-voice-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 20px rgba(188, 19, 254, 0.5);
}

.continuous-voice-btn.active {
  background: linear-gradient(135deg, #ff0077, #ff4499);
  animation: pulse-continuous 2s infinite;
}

@keyframes pulse-continuous {

  0%,
  100% {
    box-shadow: 0 0 15px rgba(255, 0, 119, 0.5);
  }

  50% {
    box-shadow: 0 0 35px rgba(255, 0, 119, 0.9);
  }
}

.continuous-hint {
  margin: 8px 0 0 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

.continuous-voice-btn.active+.continuous-hint {
  color: #ff0077;
  font-weight: 600;
  font-style: normal;
}

.continuous-voice-btn.active+.continuous-hint::before {
  content: '🎙️ ';
}

/* ========== TEXT INPUT ========== */
.chatbot-input {
  padding: 12px 15px;
  background: #16213e;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 8px;
}

.chatbot-input input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 12px 15px;
  border-radius: 25px;
  font-size: 14px;
  outline: none;
  transition: all 0.3s;
}

.chatbot-input input:focus {
  border-color: #ffeb3b;
  box-shadow: 0 0 15px rgba(255, 235, 59, 0.2);
}

.chatbot-input input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.chatbot-input button {
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, #ffeb3b, #ffd700);
  border: none;
  border-radius: 50%;
  color: #000;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s;
}

.chatbot-input button:hover {
  transform: scale(1.1);
  box-shadow: 0 5px 15px rgba(255, 235, 59, 0.4);
}

/* ========== TOGGLE BUTTON ========== */
.chatbot-toggle {
  position: fixed;
  bottom: 100px;
  /* Moved up to avoid BackToTop overlap */
  right: 30px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #ffeb3b, #ffd700);
  border: none;
  border-radius: 50%;
  color: #000;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(255, 235, 59, 0.4);
  z-index: 100000;
  /* Super high z-index */
  transition: all 0.3s;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 15px 40px rgba(255, 235, 59, 0.6);
}

.chatbot-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff0077;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 2px solid #fff;
}

@keyframes badgePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 0, 119, 0.7);
  }

  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 6px rgba(255, 0, 119, 0);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 0, 119, 0);
  }
}

.chatbot-badge.pulse-badge {
  animation: badgePulse 2s infinite;
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 768px) {
  .chatbot-container {
    width: calc(100% - 40px);
    height: calc(100vh - 140px);
    right: 20px;
    bottom: 90px;
  }

  .chatbot-toggle {
    right: 80px;
    /* Shifted left to avoid BackToTop corner */
    bottom: 25px;
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
}

@media (max-width: 380px) {
  .chatbot-container {
    width: 100%;
    height: 100vh;
    right: 0;
    bottom: 0;
    border-radius: 0;
  }

  .message-content {
    max-width: 85%;
    font-size: 13px;
  }

  .voice-controls .voice-btn span {
    display: none;
  }

  .voice-controls .voice-btn {
    padding: 8px;
    min-width: 40px;
  }
}

/* ========== MOBILE VOICE ENABLER ========== */
.mobile-voice-enabler {
  background: rgba(188, 19, 254, 0.1);
  border: 1px solid rgba(188, 19, 254, 0.3);
  border-radius: 12px;
  padding: 10px;
  margin: 5px 0;
}

.mobile-voice-enabler .message-content {
  background: transparent;
  border: none;
  padding: 5px;
  max-width: 100%;
}

.voice-enable-btn {
  background: linear-gradient(135deg, #ffeb3b, #ffd700);
  border: none;
  color: #000;
  padding: 12px 20px;
  border-radius: 25px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  animation: pulse-enable 2s infinite;
}

.voice-enable-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 20px rgba(255, 235, 59, 0.5);
}

@keyframes pulse-enable {

  0%,
  100% {
    box-shadow: 0 0 10px rgba(255, 235, 59, 0.3);
  }

  50% {
    box-shadow: 0 0 25px rgba(255, 235, 59, 0.6);
  }
}

.voice-skip-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.6);
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s;
}

.voice-skip-btn:hover {
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
}

/* Voice Enabled Success State */
.voice-enabled-indicator {
  display: none;
  color: #4ade80;
  font-size: 12px;
  margin-top: 8px;
  animation: fadeIn 0.3s ease-out;
}

.voice-enabled-indicator.show {
  display: flex;
  align-items: center;
  gap: 5px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== RESIZER ========== */
.chatbot-resizer {
  width: 20px;
  height: 20px;
  position: absolute;
  right: 0;
  bottom: 0;
  cursor: nwse-resize;
  z-index: 100;
}

.chatbot-resizer::after {
  content: '';
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(255, 235, 59, 0.5);
  border-bottom: 2px solid rgba(255, 235, 59, 0.5);
}