/* Multiplayer Modal Styles */
#multiplayerModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  backdrop-filter: blur(10px);
}

#multiplayerModal.show {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

#multiplayerModal .modal-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  padding: 0;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
}

#multiplayerModal .modal-header {
  background: rgba(255, 255, 255, 0.1);
  padding: 20px;
  border-radius: 20px 20px 0 0;
  display: flex;
  align-items: center;
  gap: 15px;
  color: white;
  position: relative;
}

#multiplayerModal .modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

#multiplayerModal .modal-header i {
  font-size: 1.8rem;
  color: #ffd700;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

#multiplayerModal .modal-body {
  padding: 30px;
  color: white;
}

/* Connection Status */
.connection-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 25px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-weight: 500;
}

.status-indicator {
  font-size: 0.8rem;
}

.status-indicator.connected {
  color: #2ed573;
}

.status-indicator.disconnected {
  color: #ff4757;
}

.status-indicator.error {
  color: #ffa502;
}

/* Input Groups */
.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.input-group input:focus {
  outline: none;
  border-color: #ffd700;
  background: rgba(255, 255, 255, 0.15);
}

.input-group input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

/* Multiplayer Options */
.multiplayer-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
}

.option-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #ffd700;
  transform: translateY(-2px);
}

.option-btn i {
  font-size: 1.2rem;
  color: #ffd700;
}

/* Join Room Section */
.join-room-section {
  animation: slideIn 0.3s ease;
}

.join-options {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.join-options .option-btn {
  flex: 1;
  justify-content: center;
  padding: 12px;
}

.spectator-btn {
  background: rgba(255, 193, 7, 0.2) !important;
  border-color: rgba(255, 193, 7, 0.4) !important;
}

/* Back Button */
.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.3s ease;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Rooms List */
.rooms-list {
  animation: slideIn 0.3s ease;
}

.rooms-container {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  margin-bottom: 10px;
  transition: all 0.3s ease;
}

.room-item:hover {
  background: rgba(255, 255, 255, 0.15);
}

.room-info h4 {
  margin: 0 0 5px 0;
  color: #ffd700;
  font-size: 1.1rem;
}

.room-info p {
  margin: 2px 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
}

.room-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.join-btn, .spectate-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.join-btn {
  background: #2ed573;
  color: white;
}

.join-btn:hover:not(:disabled) {
  background: #26d065;
}

.join-btn:disabled {
  background: #6c757d;
  cursor: not-allowed;
}

.spectate-btn {
  background: #ffa502;
  color: white;
}

.spectate-btn:hover {
  background: #ff9500;
}

.no-rooms {
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-style: italic;
  padding: 20px;
}

/* Game Room */
.game-room {
  animation: slideIn 0.3s ease;
}

.room-info h3 {
  margin: 0 0 20px 0;
  text-align: center;
  color: #ffd700;
  font-size: 1.3rem;
}

.room-players {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.player-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  min-width: 120px;
  transition: all 0.3s ease;
}

.player-slot.current-player {
  background: rgba(255, 215, 0, 0.2);
  border: 2px solid #ffd700;
}

.player-slot i {
  font-size: 1.5rem;
  color: #ffd700;
}

.player-slot span {
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

.vs-divider {
  font-size: 1.2rem;
  font-weight: bold;
  color: #ffd700;
  padding: 0 15px;
}

.spectators {
  margin-top: 15px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.spectators h4 {
  margin: 0 0 10px 0;
  color: #ffa502;
  font-size: 1rem;
}

.spectator-list {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

.room-controls {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.room-controls .control-btn {
  flex: 1;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.room-controls .control-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #ffd700;
}

.start-game-btn {
  background: linear-gradient(45deg, #2ed573, #1dd1a1) !important;
  border-color: rgba(46, 213, 115, 0.3) !important;
  color: white !important;
  font-weight: 600 !important;
}

.start-game-btn:hover {
  background: linear-gradient(45deg, #1dd1a1, #2ed573) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 5px 15px rgba(46, 213, 115, 0.4) !important;
}

/* Multiplayer Button in Main Controls */
.multiplayer-btn {
  background: linear-gradient(45deg, #667eea, #764ba2) !important;
  border-color: rgba(102, 126, 234, 0.3) !important;
}

.multiplayer-btn:hover {
  background: linear-gradient(45deg, #764ba2, #667eea) !important;
  transform: translateY(-3px) !important;
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4) !important;
}

/* Error and Success Messages */
.error-message, .success-message {
  font-weight: 500;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  #multiplayerModal .modal-content {
    width: 95%;
    margin: 10px;
  }
  
  .multiplayer-options {
    gap: 12px;
  }
  
  .option-btn {
    padding: 12px 16px;
    font-size: 0.9rem;
  }
  
  .room-players {
    flex-direction: column;
    gap: 15px;
  }
  
  .vs-divider {
    transform: rotate(90deg);
  }
  
  .join-options {
    flex-direction: column;
  }
  
  .room-controls {
    flex-direction: column;
  }
}