/* ============================================
   Shared Chat & Voice Chat System Styles
   يستخدم في جميع الألعاب
============================================ */

/* Floating Chat Button */
.show-chat-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
  border: 3px solid #fbbf24;
  color: white;
  font-size: 32px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(30, 58, 138, 0.6);
  transition: all 0.3s ease;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.show-chat-btn:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 12px 35px rgba(30, 58, 138, 0.8);
  border-color: #fcd34d;
}

.show-chat-btn.active {
  background: linear-gradient(135deg, #4c1d95 0%, #6b21a8 100%);
  animation: pulse-glow 1.5s ease-in-out infinite;
}

/* Floating Voice Chat Button */
.show-voice-chat-btn {
  position: fixed;
  bottom: 30px;
  right: 120px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  border: 3px solid #fbbf24;
  color: white;
  font-size: 32px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(5, 150, 105, 0.6);
  transition: all 0.3s ease;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.show-voice-chat-btn:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 12px 35px rgba(5, 150, 105, 0.8);
  border-color: #fcd34d;
}

.show-voice-chat-btn.active {
  background: linear-gradient(135deg, #991b1b 0%, #b91c1c 100%);
  animation: voice-pulse 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { 
    box-shadow: 0 8px 25px rgba(76, 29, 149, 0.6);
    transform: scale(1);
  }
  50% { 
    box-shadow: 0 12px 40px rgba(76, 29, 149, 0.9);
    transform: scale(1.05);
  }
}

@keyframes voice-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Chat Badge */
.chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4757;
  color: white;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  border: 2px solid white;
  animation: pulse-badge 1s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Voice Badge (Live Indicator) */
.voice-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4757;
  color: white;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  border: 2px solid white;
  animation: pulse-badge 1s ease-in-out infinite;
}

/* Chat Sidebar */
.chat-side {
  position: fixed;
  right: 0;
  top: 0;
  width: 350px;
  height: 100vh;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  border-left: 2px solid rgba(251, 191, 36, 0.3);
}

.chat-side.hidden {
  transform: translateX(100%);
}

.chat-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(251, 191, 36, 0.3);
}

.chat-header h3 {
  margin: 0;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.close-chat {
  background: rgba(251, 191, 36, 0.2);
  border: none;
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
}

.close-chat:hover {
  background: rgba(251, 191, 36, 0.4);
  transform: rotate(90deg);
}

/* Messages List */
.messages-list {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #0f172a;
}

.message {
  margin-bottom: 15px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.own-message {
  text-align: right;
}

.message .sender-name {
  font-size: 12px;
  color: #fbbf24;
  font-weight: bold;
  margin-bottom: 5px;
}

.message.own-message .sender-name {
  color: #fcd34d;
}

.message-bubble {
  display: inline-block;
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 15px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(251, 191, 36, 0.2);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  word-wrap: break-word;
  color: #f8fafc;
}

.message.own-message .message-bubble {
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
  color: white;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.message-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 5px;
}

.message.own-message .message-time {
  color: rgba(255, 255, 255, 0.7);
}

/* Chat Input */
.chat-input-container {
  padding: 15px;
  background: #1e293b;
  border-top: 2px solid rgba(251, 191, 36, 0.3);
  display: flex;
  gap: 10px;
}

.chat-input {
  flex: 1;
  padding: 12px 15px;
  border: 2px solid rgba(251, 191, 36, 0.3);
  border-radius: 25px;
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
  background: rgba(15, 23, 42, 0.8);
  color: #f8fafc;
}

.chat-input::placeholder {
  color: #94a3b8;
}

.chat-input:focus {
  border-color: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
  background: rgba(15, 23, 42, 0.95);
}

.send-btn {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
  border: 2px solid #fbbf24;
  color: white;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.send-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.5);
}

.send-btn:active {
  transform: scale(0.95);
}

/* Voice Chat Panel */
.voice-chat-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 500px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-radius: 20px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
  z-index: 1001;
  transition: all 0.3s ease;
  border: 2px solid rgba(251, 191, 36, 0.3);
}

.voice-chat-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.9);
}

.voice-chat-header {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: white;
  padding: 20px;
  border-radius: 18px 18px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(251, 191, 36, 0.3);
}

.voice-chat-header h3 {
  margin: 0;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.close-voice-chat {
  background: rgba(251, 191, 36, 0.2);
  border: none;
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
}

.close-voice-chat:hover {
  background: rgba(251, 191, 36, 0.4);
  transform: rotate(90deg);
}

.voice-chat-content {
  padding: 25px;
}

.voice-status {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.8) 100%);
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.voice-status i {
  color: #10b981;
  font-size: 20px;
}

.voice-status p {
  margin: 0;
  color: #cbd5e1;
  font-size: 14px;
}

.voice-status.connected {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.3) 0%, rgba(16, 185, 129, 0.3) 100%);
  border-color: #10b981;
}

.voice-status.connected i {
  color: #10b981;
}

.voice-players-list {
  max-height: 250px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.voice-player {
  background: rgba(30, 41, 59, 0.6);
  padding: 12px 15px;
  border-radius: 10px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.voice-player:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(251, 191, 36, 0.4);
}

.voice-player-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.voice-player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  border: 2px solid #fbbf24;
}

.voice-player-name {
  font-weight: bold;
  color: #f8fafc;
}

.voice-player-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speaking-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dc3545;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.voice-player.speaking .speaking-indicator {
  opacity: 1;
  animation: pulse-badge 0.8s ease-in-out infinite;
}

.muted-indicator {
  color: #dc3545;
  font-size: 16px;
}

.voice-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.btn-voice-toggle,
.btn-mute-toggle {
  flex: 1;
  padding: 15px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
}

.btn-voice-toggle {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: white;
}

.btn-voice-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(16, 185, 129, 0.5);
}

.btn-voice-toggle.active {
  background: linear-gradient(135deg, #991b1b 0%, #b91c1c 100%);
}

.btn-mute-toggle {
  background: rgba(100, 116, 139, 0.8);
  color: white;
}

.btn-mute-toggle:hover {
  background: rgba(100, 116, 139, 1);
  transform: translateY(-2px);
}

.btn-mute-toggle.muted {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

.voice-note {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.voice-note i {
  color: #fbbf24;
  margin-top: 2px;
}

.voice-note small {
  color: #cbd5e1;
  line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 768px) {
  .chat-side {
    width: 100%;
  }
  
  .show-chat-btn,
  .show-voice-chat-btn {
    width: 50px;
    height: 50px;
    font-size: 20px;
    bottom: 20px;
  }
  
  .show-chat-btn {
    right: 20px;
  }
  
  .show-voice-chat-btn {
    right: 85px;
  }
  
  .voice-chat-panel {
    width: 95%;
    max-width: 400px;
  }
}

/* Hidden Class */
.hidden {
  display: none !important;
}
